org.apache.axiom.om.ds.jaxb
Class JAXBOMDataSource

java.lang.Object
  extended by org.apache.axiom.om.ds.AbstractOMDataSource
      extended by org.apache.axiom.om.ds.AbstractPushOMDataSource
          extended by 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().


Field Summary
 
Fields inherited from interface org.apache.axiom.om.OMDataSourceExt
LOSSY_PREFIX
 
Constructor Summary
JAXBOMDataSource(javax.xml.bind.JAXBContext context, java.lang.Object object)
          Constructor.
 
Method Summary
 OMDataSourceExt copy()
           
 java.lang.String getLocalName()
           
 java.lang.String getNamespaceURI()
           
 java.lang.Object getObject()
           
 java.lang.String getPrefix()
           
 boolean isDestructiveWrite()
           
 void serialize(javax.xml.stream.XMLStreamWriter writer)
           
 
Methods inherited from class org.apache.axiom.om.ds.AbstractPushOMDataSource
getReader, isDestructiveRead
 
Methods inherited from class org.apache.axiom.om.ds.AbstractOMDataSource
close, getProperty, getXMLBytes, getXMLInputStream, hasProperty, serialize, serialize, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.axiom.om.OMDataSource
getReader, serialize, serialize
 

Constructor Detail

JAXBOMDataSource

public JAXBOMDataSource(javax.xml.bind.JAXBContext context,
                        java.lang.Object object)
Constructor.

Parameters:
context - the JAXB context to which the object is known
object - the JAXB object; this may be a plain Java bean or a JAXBElement
Method Detail

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.