A few things... > Jackson javadoc seems to imply that XmlAnyElement is "not >applicable" to JSON mapping.
What I think they are actually saying in the javadoc[1] is that JAXBElement cannot be mapped to JSON with Jackson. I'm assuming that the reasoning there is because Jackson is based on an annotation/introspection model. At least, that's how I understand it. So, it can't (or won't because it can't guarantee rather) introspect the object that lies under the JAXBElement instance. So, by them thinking that @XmlAnyElement only applies to JAXBElement, they eliminated support for the annotation. > Do we have a fundamental disagreement with Jackson's claim? What we can do is go back to them with a question about the statement in their javadoc. In the javadoc for @XmlAnyElement[2], it clearly shows examples where that annotation is used for generic bean types (Object) as opposed to just JAXBElement instances. Maybe I'm missing something here though and all of the elements that would correspond to the any type are going to be turned in to JAXBElement instances anyway. Thoughts? > I'm thinking we may just need to write our own provider >or perhaps we have to provide our own JaxbAnnotationIntrospector? Personally I'd rather we engage the Jackson team to here and see if we can come up with a solution together. I know Dan has been able to get Jackson working in CXF. Dan, have you made any claims as to limitations of support for binding via Jackson? Or, have you run into this scenario at all? -Nick [1] - http://jackson.codehaus.org/1.2.0/javadoc/org/codehaus/jackson/xc/JaxbAnnotationIntrospector.html [2] - http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlAnyElement.html Nicholas Gallardo WebSphere - REST & WebServices Development [email protected] Phone: 512-286-6258 Building: 903 / 5G-016 Bryant Luk <bryant....@gmail .com> To [email protected] 09/02/2009 10:09 cc AM Subject Re: Jackson provider -- no support Please respond to for @XmlAnyElement wink-...@incubato r.apache.org I think it's a good exercise to see how well Jackson can interoperate with the models in wink-common in particular ATOM. I think that's one of the things users would do. People are very particular about their JSON output/input and while there are some conventions from Java/XML to JSON I think it will benefit if we can get more of the JSON providers working out of the box since each has their unique features. Hopefully have some time later to take a look. On Tuesday, September 1, 2009, Michael Rheinheimer <[email protected]> wrote: > > Hi, I attached a sample Eclipse project to WINK-154 to demonstrate this: https://issues.apache.org/jira/browse/WINK-154 > > Hopefully that can be a launch point for getting to the right usage of Jackson. I'm thinking we may just need to write our own provider or perhaps we have to provide our own JaxbAnnotationIntrospector? > > I confess I have not done a deep dive into this yet, but I will. I figured it's worthwhile to summon the power of teamwork from the outset. :) > > mike > > > > Michael Rheinheimer---09/01/2009 01:11:19 PM---Hi Team, In an attempt to get Jackson > > > > From: > Michael Rheinheimer/Austin/i...@ibmus > > > To: > [email protected] > > > Date: > 09/01/2009 01:11 PM > > > Subject: > Jackson provider -- no support for @XmlAnyElement > > > > > > > Hi Team, > > In an attempt to get Jackson > (http://wiki.fasterxml.com/JacksonInFiveMinutes) JAX-RS provider working, I > ran into a bit of a snag. The Jackson deserializer cannot handle fields > annotated with @XmlAnyElement. We use this in several places in a few > classes under org.apache.wink.common.model.atom (see AtomPerson, for > example). > > Jackson cannot serialize XmlAnyElement, per the javadoc: > > > http://jackson.codehaus.org/1.2.0/javadoc/org/codehaus/jackson/xc/JaxbAnnotationIntrospector.html > > So, what is the right course of action here? Jackson javadoc seems to > imply that XmlAnyElement is "not applicable" to JSON mapping. Our > implementation of Atom* implies otherwise. Do we want to claim support for > Jackson, but only when the JAXB objects being (de)serialized have no fields > annotated with XmlAnyElement (i.e. not Atom)? Do we have a fundamental > disagreement with Jackson's claim? > > I briefly looked at adding custom (de)serializers to Jackson to support > XmlAnyElement, but I did not get very far. I wanted to float this issue to > get some opinions before spending too much time on it. > > Any ideas or opinions? > > Thanks.. > mike > > > >
