FasterXML / jackson-dataformat-xml

Extension for Jackson JSON processor that adds support for serializing POJOs as XML (and deserializing from XML) as an alternative to JSON
Apache License 2.0
561 stars 221 forks source link

Support serialization of `Iterator` and `Stream` #597

Closed JooHyukKim closed 1 year ago

JooHyukKim commented 1 year ago

resolves below issues

pjfanning commented 1 year ago

@JooHyukKim should we also add deserialization tests? If you feel this is too much for this PR but suspect that we do need more work on the deserialization, could you log a follow up issue?

JooHyukKim commented 1 year ago

@JooHyukKim should we also add deserialization tests? If you feel this is too much for this PR but suspect that we do need more work on the deserialization, could you log a follow up issue?

@pjfanning I certainly agree we need deserialization counterpart. And yes, let's (I will) create a follow up issue, because I think this already affects broad scope 😄

cowtowncoder commented 1 year ago

On this PR specifically, we could consider doing:

  1. Hard-coded approach for 2.15 or 2.16 initially
  2. Clean up later on if and when JavaType adds detection functionality.
pjfanning commented 1 year ago

@JooHyukKim could you create a shared method for checking the class for these Iterator.class.isAssignableFrom(cls) || Stream.class.isAssignableFrom(cls) ?

This check appears twice so it would be good to share the check (just in case we need to add more classes to the check).

JooHyukKim commented 1 year ago

@JooHyukKim could you create a shared method for checking the class for these Iterator.class.isAssignableFrom(cls) || Stream.class.isAssignableFrom(cls) ?

This check appears twice so it would be good to share the check (just in case we need to add more classes to the check).

Sure 👍🏻, Sounds great!

JooHyukKim commented 1 year ago

Come to think of it, related issues have been around a long time. Should we rebase this PR agaisnt 2.15? 🤔

pjfanning commented 1 year ago

Not a big deal but I wrote https://github.com/FasterXML/jackson-module-scala/pull/636 to try out this problem with Scala Iterators and there is an issue and this fix won't help (for Scala Iterators). That doesn't mean we shouldn't proceed - it just highlights that adding a JavaType based solution in the future would be useful.

JooHyukKim commented 1 year ago

To keep track of things, let's link this to FasterXML/jackson-databind#3926