NOTE: when use for Java enums, one additional feature is that value returned by annotated method is also considered to be the value to deserialize from, not just JSON String to serialize as. This is possible since set of Enum values is constant and it is possible to define mapping, but can not be done in general for POJO types; as such, this is not used for POJO deserialization.
https://github.com/FasterXML/jackson-databind/issues/2352 added support for using
@JsonAlias
to accept alternate enum values. However, this functionality is not documented in the@JsonAlias
Javadocs. It was therefore quite the surprise to me to discover this was a valid usage.I believe the Javadocs should be updated to document this case.
Examples in other annotations that change enum values in addition to a separate primary usage:
@JsonValue
:@JsonProperty
: