I am a JaxB noob, but I've learned a lot about how to configure Jackson. I am adding XML serialization/deserialization support for some domain object classes. I have a class type that is serialized/deserialized differently depending on a context which must be specified.
I was able to accomplish this in Jackson by writing a custom implementation of
You can bind any XmlAdapter class to a concrete instance. Both JAXB Marshaller/Unmarshaller interfaces provide method setAdapter
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setAdapter(new MyClassXmlAdapter(...));
Now all fields/types annotated with @XmlJavaTypeAdapter will be adapted with given instance