Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AnnotatedType #66

Open
jansupol opened this issue Jan 1, 2018 · 2 comments
Open

Support AnnotatedType #66

jansupol opened this issue Jan 1, 2018 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@jansupol
Copy link
Owner

jansupol commented Jan 1, 2018

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.

@jansupol
Copy link
Owner Author

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

@jansupol
Copy link
Owner Author

@jansupol jansupol added the enhancement New feature or request label May 23, 2018
@jansupol jansupol added this to the 2.0 milestone May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant