Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serializer and Deserializer for RangeSet #50

Merged
merged 1 commit into from Sep 19, 2019
Merged

Add Serializer and Deserializer for RangeSet #50

merged 1 commit into from Sep 19, 2019

Conversation

Felk
Copy link
Contributor

@Felk Felk commented Apr 12, 2019

I had to write a generic serializer and deserializer for guava's RangeSet a while ago. While I did have a hard time understanding how exactly custom serializers and deserializers work, I managed to get it working. I believe that the code can be worked into an acceptable state with some feedback and help. For now, here's my slightly modified version of what we are currently using.

@cowtowncoder
Copy link
Member

First of all, apologies for a slow follow up. Second: thank you for the contribution!

I'd be happy to merge this, but before I can do that there is one practical thing: we need a Contributor License Agreement (CLA), which is here:

https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf

and the simplest way usually is to print it, fill & sign, scan, email to info at fasterxml dot com.
This only needs to be done once and then works for all contributions for any Jackson project.

On patch, one suggestion that might help: in findBeanDeserializer, JavaType can be used to figure out type parameters for Range, something like:

// note: `type.containedType(0)` also works for deserialization case where subtypes not supported
JavaType[] params = config.getTypeFactory().findTypeParameters(type, Range.class);
JavaType typeParam = (params.length == 1) ? params[0] : config.getTypeFactory().unknownType();

which would avoid needing to use createContextual(). I can make this change as well if you prefer.

Also: I think this would make sense to backport in 2.10 (or depending on timing, 2.9[.9]). I can do that.

@Felk
Copy link
Contributor Author

Felk commented Sep 18, 2019

Alright, I finally sent you the license contributor agreement. Sorry for forgetting about this.

I can make this change as well if you prefer.

That'd be easier, yes please

@cowtowncoder
Copy link
Member

@Felk excellent, looking forward to getting this merged!

@cowtowncoder cowtowncoder marked this pull request as ready for review September 19, 2019 01:52
@cowtowncoder cowtowncoder merged commit b6ecd7e into FasterXML:master Sep 19, 2019
@cowtowncoder cowtowncoder changed the title add Serializer and Deserializer for RangeSet Add Serializer and Deserializer for RangeSet Sep 19, 2019
cowtowncoder added a commit that referenced this pull request Sep 19, 2019
@cowtowncoder cowtowncoder added this to the 2.10.0 milestone Sep 19, 2019
@Felk Felk deleted the rangeset-ser-deser branch January 10, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants