You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you delete the getter getIgnored(), the following exception will be thrown:
Exception in thread "main" com.fasterxml.jackson.databind.RuntimeJsonMappingException: Cannot deserialize value of type `java.lang.Integer` from String "ignoredValue": not a valid `java.lang.Integer` value
at [Source: (StringReader); line: 1, column: 5] (through reference chain: Example["number"])
at com.fasterxml.jackson.databind.MappingIterator._handleMappingException(MappingIterator.java:416)
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:201)
at Example.main(Example.java:55)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.lang.Integer` from String "ignoredValue": not a valid `java.lang.Integer` value
at [Source: (StringReader); line: 1, column: 5] (through reference chain: Example["number"])
at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1958)
at com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:1245)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseInteger(StdDeserializer.java:848)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseInteger(StdDeserializer.java:827)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:531)
at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:506)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:545)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:570)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:440)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1493)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:348)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
at com.fasterxml.jackson.databind.MappingIterator.nextValue(MappingIterator.java:283)
at com.fasterxml.jackson.databind.MappingIterator.next(MappingIterator.java:199)
... 1 more
Is this expected behavior? Is there something I can do to omit writing these getters?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm wondering that I have to write getters for ignored properties. Here's an working example:
If you delete the getter
getIgnored()
, the following exception will be thrown:Is this expected behavior? Is there something I can do to omit writing these getters?
Jackson-Version: 2.17.1
Related issue: https://github.com/FasterXML/jackson-databind/issues/4528
Beta Was this translation helpful? Give feedback.
All reactions