org.apache.axiom.om.ds

## Class AbstractPushOMDataSource

- java.lang.Object
- - org.apache.axiom.om.ds.AbstractOMDataSource
  - - org.apache.axiom.om.ds.AbstractPushOMDataSource

- All Implemented Interfaces:
    OMDataSource, OMDataSourceExt
  Direct Known Subclasses:
    JAXBOMDataSource

      public abstract class AbstractPushOMDataSource
      extends AbstractOMDataSource

  Base class for `OMDataSourceExt` implementations that can easily serialize the content to an `XMLStreamWriter` but that are unable to produce the content as an `XMLStreamReader`.

  `OMSourcedElement` will handle `OMDataSource` implementations extending this class differently when it comes to expansion: instead of using `OMDataSource.getReader()` to expand the element, it will use `OMDataSource.serialize(XMLStreamWriter)` (with a special `XMLStreamWriter` that builds the descendants of the `OMSourcedElement`). This means that such an `OMSourcedElement` will be expanded instantly, and that deferred building of the descendants is not applicable.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.axiom.om.OMDataSourceExt

      `LOSSY_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractPushOMDataSource()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.xml.stream.XMLStreamReader` | `getReader()` Get parser for element data.
    `boolean` | `isDestructiveRead()` Returns true if reading the backing object is destructive.

    - ### Methods inherited from class org.apache.axiom.om.ds.AbstractOMDataSource

      `close, copy, getObject, 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.OMDataSourceExt

      `isDestructiveWrite`

    - ### Methods inherited from interface org.apache.axiom.om.OMDataSource

      `serialize`

- - ### Constructor Detail

    - #### AbstractPushOMDataSource

          public AbstractPushOMDataSource()

  - ### Method Detail

    - #### isDestructiveRead

          public final boolean isDestructiveRead()

      Description copied from interface: `OMDataSourceExt`
      Returns true if reading the backing object is destructive. An example of an object with a destructive read is an InputSteam. The owning OMSourcedElement uses this information to detemine if OM tree expansion is needed when reading the OMDataSourceExt.
      Returns:
        boolean

    - #### getReader

          public final javax.xml.stream.XMLStreamReader getReader()
                                                           throws javax.xml.stream.XMLStreamException

      Description copied from interface: `OMDataSource`
      Get parser for element data. In the general case this may require the data source to serialize data as XML text and then parse that text.

      It is assumed that this method consumed the content (i.e. destroys the backing object) unless the data source also implements `OMDataSourceExt` and `OMDataSourceExt.isDestructiveRead()` returns `false`.

      `OMSourcedElement` implementations are expected to call `XMLStreamReader.close()` on the returned reader as soon as the element is completely built.

      Returns:
        element parser
      Throws:
        `javax.xml.stream.XMLStreamException`

Copyright © The Apache Software Foundation. All Rights Reserved.