The rationale is that the deserializer gains the ability to make decisions based on the type annotations.
E.g.
For a type such as List<@Base64 Key> it would be possible to create a (de)serializer that performs custom logic (e.g. Base64-encode/decode the value on the way in/out) for types annotated with @Base64 regardless of their class.
Since Java 8 introduced TYPE_USE annotations, and this API is a Java standard as well, one would expect the two to work together.
I suggest JSON-B is enhanced (the implementation at least, if not the spec) to support
AnnotatedType
.Namely, the following methods should exist:
Jsonb#fromJson(String, AnnotatedType)
JsonbDeserializer#deserialize(JsonParser, DeserializationContext, AnnotatedType)
The rationale is that the deserializer gains the ability to make decisions based on the type annotations.
E.g. For a type such as
List<@Base64 Key>
it would be possible to create a (de)serializer that performs custom logic (e.g. Base64-encode/decode the value on the way in/out) for types annotated with@Base64
regardless of their class.