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

Add JsonbEnumValue annotation for enumerated types #255

Open
KeyBridge opened this issue Aug 18, 2020 · 2 comments
Open

Add JsonbEnumValue annotation for enumerated types #255

KeyBridge opened this issue Aug 18, 2020 · 2 comments

Comments

@KeyBridge
Copy link

Json-b presently does not appear to recognize or honor @JsonbProperty annotation when applied to enumerated types. We suggest adding an annotation type that implements the same logic as @XmlEnumValue

Without this function a custom type adapter is required for all enumerated types with non-Java characters (e.g. '-') in their names. For example, the first entry in the following enum requires a dash instead of underscore. @JsonbProperty is presently not picked up or recognized.

public enum foo {
  @JsonbEnumValue("A256CBC-HS512")
  A256CBC_HS512,
  A128GCM;
}

Thanks!

Referencing [https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/annotation/XmlEnumValue.html](XmlEnumValue)
@rmannibucau
Copy link

rmannibucau commented Aug 19, 2020

Hi @KeyBridge ,

What about reusing @JsonbProperty which looks the more intuitive solution to me?

edit: made johnzon supporting it https://issues.apache.org/jira/browse/JOHNZON-321

@KeyBridge
Copy link
Author

Absolutely.

If possible, extending @JsonbProperty to recognize enum types would be easier for the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants