jsonb-api
jsonb-api copied to clipboard
Add JsonbEnumValue annotation for enumerated types
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)
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
Absolutely.
If possible, extending @JsonbProperty to recognize enum types would be easier for the user.