Class JAXBOMDataSource

All Implemented Interfaces:
OMDataSource, OMDataSourceExt, QNameAwareOMDataSource

public class JAXBOMDataSource extends AbstractPushOMDataSource implements QNameAwareOMDataSource
OMDataSource backed by a JAXB object. This class can be used both for plain JAXB objects and for JAXBElement instances. It implements QNameAwareOMDataSource so that it can be used with OMFactory.createOMElement(OMDataSource), i.e. it is not necessary to supply the QName during construction of the OMSourcedElement. It also has full support for XOP/MTOM. It is implemented as a push-style OMDataSource so that an OMSourcedElement backed by an instance of this class can be expanded in an efficient way (including the case where the JAXB object contains base64 binary data represented as DataHandler instances or byte arrays).

The JAXB object encapsulated by an instance of this class can be retrieved using OMDataSourceExt.getObject(). Note that modifying the JAXB object after passing it to the constructor may result in unexpected behavior and should be avoided.

Instances of this class are non destructive, in the sense defined by OMDataSourceExt.isDestructiveWrite().