We have a class Beans used to serialize a list of generic objects into an xml. This is done like this:
Beans
public class Call { public Beans input; public Beans output; ... } @XmlJavaTypeAdapter(value = BeanAdapter.class) public class Beans { public List<Object> bean; }
Thanks to @XmlJavaTypeAdapter, we're able to write xml in whatever form we want.
@XmlJavaTypeAdapter
When we're serializing a Call instance:
Call
Call call = ... Beans beans = ...; call.setInput(beans); JAXBContext context = ...; Marshaller marshaler = context.createMarshaller(); ObjectFactory factory = ...; marshaler.marshal(factory.createCall(call), result);
things work as expected, meaning that BeanAdapter is used during xml serialization. But if it's happened that you want to serialize a Beans instance itself, you start getting problems with the serialization of unknown objects. That's because JAXB does not use BeanAdapter.
BeanAdapter
We have found a similar case "How to assign an adapter to the root element?", unfortunately with no satisfactory explanation.
That is strange.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u