Replies: 1 comment
-
Key serializer/deserializer settings are not same as value (de)serializer: there are separate So this distinction exists due to limitations on legal value types. In hindsight it might have been good idea to require So, in short: yes, this is expected: registering value serializer/deserializer does not register handler for |
Beta Was this translation helpful? Give feedback.
-
When an Object utilizes a class level custom deserialier
@JsonDeserialize(using = XXX.class)
or class level custom serializer@JsonSerialize(using = XXX.class)
, these are not utilized when deserializing/serializing the key of a map.Example project linked shows use case with the class
com.google.cloud.tools.jib.api.DescriptorDigest
. Class level deserializer is utilized for class DescriptorDigest when deserialized directly or as aSet<DescriptorDigest>
. The class level deserializer is not utilized when DescriptorDigest is a key or value in a map. Instead the constructor is called viaMapDeserializer
andStdKeyDeserializer.StringCtorKeyDeserializer
. Note the same is true for serialization.Is this the expected behavior? Collections are able to infer the type and utilize class level custom deserializers/serializers, so I found it odd that Map was unable to do this without an explicit
@JsonDeserialize(keyUsing = <KeyDeserializer>.class)
, see code.Beta Was this translation helpful? Give feedback.
All reactions