Support AnnotatedType

Bojan Tomic
 

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, thus on a much more fine-grained level than currently possible.

Example:
For a type such as List<@Id Key> it would be possible to create a deserializer that performs custom logic for types annotated with @Id regardless of their class e.g. Base64-decode them on the way in.

Join jsonb-spec@javaee.groups.io to automatically receive all group messages.