Skip to content

Support AnnotatedType #66

Description

@jsonbrobot

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions