org.apache.axiom.om.ds.jaxb
Class JAXBOMDataSource
java.lang.Object
org.apache.axiom.om.ds.AbstractOMDataSource
org.apache.axiom.om.ds.AbstractPushOMDataSource
org.apache.axiom.om.ds.jaxb.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().
|
Constructor Summary |
JAXBOMDataSource(javax.xml.bind.JAXBContext context,
java.lang.Object object)
Constructor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JAXBOMDataSource
public JAXBOMDataSource(javax.xml.bind.JAXBContext context,
java.lang.Object object)
- Constructor.
- Parameters:
context - the JAXB context to which the object is knownobject - the JAXB object; this may be a plain Java bean or a JAXBElement
isDestructiveWrite
public boolean isDestructiveWrite()
- Specified by:
isDestructiveWrite in interface OMDataSourceExt
serialize
public void serialize(javax.xml.stream.XMLStreamWriter writer)
throws javax.xml.stream.XMLStreamException
- Specified by:
serialize in interface OMDataSource
- Throws:
javax.xml.stream.XMLStreamException
getLocalName
public java.lang.String getLocalName()
- Specified by:
getLocalName in interface QNameAwareOMDataSource
getNamespaceURI
public java.lang.String getNamespaceURI()
- Specified by:
getNamespaceURI in interface QNameAwareOMDataSource
getPrefix
public java.lang.String getPrefix()
- Specified by:
getPrefix in interface QNameAwareOMDataSource
getObject
public java.lang.Object getObject()
- Specified by:
getObject in interface OMDataSourceExt- Overrides:
getObject in class AbstractOMDataSource
copy
public OMDataSourceExt copy()
- Specified by:
copy in interface OMDataSourceExt- Overrides:
copy in class AbstractOMDataSource
Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.