jansupol / jsonbapi

0 stars 0 forks source link

Support AnnotatedType #66

Open jansupol opened 6 years ago

jansupol commented 6 years ago

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:

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.

jansupol commented 6 years ago
jansupol commented 6 years ago

@m0mus Commented Added to the next spec version proposed features.