-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow JsonbDeserializer based on generic types #14824
Allow JsonbDeserializer based on generic types #14824
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; shouldn't you be able to get away with a single field of type Type
though (which Class
implements)? Saving one field and the if/else upon deserialize.
@gunnarmorling right but there is two different |
Yes, theoretically, fromJson(InputStream, Class<?>) could do something
different than fromJson(InputStream, Type) when receiving a Class.
Yasson has the former call the latter, so it's exactly the same. But
even if that were not the case, any fromJson(InputStream, Type)
implementation should still do the right thing when being invoked for
any subtype. So I'd go for that, but it's your call, I'm not hung up
on it :)
|
373a59a
to
bc4c70d
Compare
@gunnarmorling the simplier the better :) I updated the PR accordingly |
@gsmet all native jobs failed, I let you relaunch CI when it's OK for you, hope it will be able to make it inside 1.2 |
bc4c70d
to
24e34fc
Compare
I rebased. |
This PR allows to use the existing JsonbDeserializer not only based on a Class but also on a Type.
This allows to deals with Generic collections https://javaee.github.io/jsonb-spec/docs/user-guide.html#mapping-a-generic-collection