users@jersey.java.net

[Jersey] Re: _at_XmlEnumValue is not recognized by Jackson

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Fri, 8 Apr 2011 10:53:06 -0700

On Fri, Apr 8, 2011 at 4:05 AM, Pengfei Di <pengfei.di_at_match2blue.com> wrote:
> Hello Tatu,
>
> thank you for your hint. I just found the reason.
> I have to turn of the POJOMapping feature, otherwise the JacksonJsonProvider
> instead of the AbstractRootElementProvider will be used for JSON
> representation.
>
> Now what I get ist: {"myEnum": "2"}
> As you said, @XmlEnum is unfortunately not support.
> What is confusing is that there is no statement from the jackson web site,
> whether this annotation will be supported in the future or will not.

JAXB support for Jackson is a nice-to-have thing, and supported by
community. So if a patch was submitted, support could be added.
I assume no one has needed support for this particular feature so far
(or, it has been difficult to implement).
Having said that, the main downside seems to be that output is as JSON
String, instead of JSON number. I am not sure how significant this is,
as value can be read back without issues.

List of supported annotations is at
[http://wiki.fasterxml.com/JacksonJAXBAnnotations]; if an annotation
is not listed, it probably is not supported.
Anything that is listed as support is; but there may be time lag on
things getting added.

For more discussion on specific Jackson support for JAXB annotations,
jackson users mailing list is the best place.

-+ Tatu +-