public class JAXBOMDataSource
extends org.apache.axiom.om.ds.AbstractPushOMDataSource
implements org.apache.axiom.om.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().
| Constructor and Description |
|---|
JAXBOMDataSource(javax.xml.bind.JAXBContext context,
Object object)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.axiom.om.OMDataSourceExt |
copy() |
String |
getLocalName() |
String |
getNamespaceURI() |
Object |
getObject() |
String |
getPrefix() |
boolean |
isDestructiveWrite() |
void |
serialize(javax.xml.stream.XMLStreamWriter writer) |
getReader, isDestructiveReadclose, getProperty, getXMLBytes, getXMLInputStream, hasProperty, serialize, serialize, setPropertypublic JAXBOMDataSource(javax.xml.bind.JAXBContext context, Object object)
context - the JAXB context to which the object is knownobject - the JAXB object; this may be a plain Java bean or a JAXBElementpublic boolean isDestructiveWrite()
isDestructiveWrite in interface org.apache.axiom.om.OMDataSourceExtpublic void serialize(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamException
serialize in interface org.apache.axiom.om.OMDataSourcejavax.xml.stream.XMLStreamExceptionpublic String getLocalName()
getLocalName in interface org.apache.axiom.om.QNameAwareOMDataSourcepublic String getNamespaceURI()
getNamespaceURI in interface org.apache.axiom.om.QNameAwareOMDataSourcepublic String getPrefix()
getPrefix in interface org.apache.axiom.om.QNameAwareOMDataSourcepublic Object getObject()
getObject in interface org.apache.axiom.om.OMDataSourceExtgetObject in class org.apache.axiom.om.ds.AbstractOMDataSourcepublic org.apache.axiom.om.OMDataSourceExt copy()
copy in interface org.apache.axiom.om.OMDataSourceExtcopy in class org.apache.axiom.om.ds.AbstractOMDataSourceCopyright © The Apache Software Foundation. All Rights Reserved.