We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to use @JsonCreator to deserialize BigInteger to Enum.
public enum TestEnum { AAA(BigInteger.valueOf(1)), BBB(BigInteger.valueOf(2)); private TestEnum(BigInteger key) { this.key = key; } private BigInteger key; @JsonValue public BigInteger getKey() { return this.key; } @JsonCreator public static TestEnum valueOf(BigInteger key) { /* ... BigInteger to TestEnum ... */ return _enum; } }
Now, @JsonCreator compatible with String, Integer, and Long. So, I get IllegalArgumentException. https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java#L41-L51
and user cannot change EnumDeserializer class (need to custormize BasicDeserializerFactory). https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java#L1222
I know about @JsonDeserialize and SimpleModule, but they take time applying to each Enums.
Is it possible to add BigInteger deserializing for @JsonCreator ?
The text was updated successfully, but these errors were encountered:
Sounds like implementation is incomplete. Yes, ideally any type should be usable that way. Apologies for trouble & thank you for reporting this.
Sorry, something went wrong.
Wow! Thank you for considering my request!
Actually, previous commit was for #560, which is now implemented
3afaa74
Implemented, will be in 2.5.0.
No branches or pull requests
I want to use @JsonCreator to deserialize BigInteger to Enum.
Now, @JsonCreator compatible with String, Integer, and Long. So, I get IllegalArgumentException.
https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java#L41-L51
and user cannot change EnumDeserializer class (need to custormize BasicDeserializerFactory).
https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java#L1222
I know about @JsonDeserialize and SimpleModule, but they take time applying to each Enums.
Is it possible to add BigInteger deserializing for @JsonCreator ?
The text was updated successfully, but these errors were encountered: