org.apache.axiom.om.impl.llom
Class OMNodeImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.llom.OMSerializableImpl
      extended by org.apache.axiom.om.impl.llom.OMNodeImpl
All Implemented Interfaces:
OMNodeEx, OMNode, OMSerializable
Direct Known Subclasses:
OMCommentImpl, OMDocTypeImpl, OMElementImpl, OMProcessingInstructionImpl, OMTextImpl

public abstract class OMNodeImpl
extends OMSerializableImpl
implements OMNode, OMNodeEx

Class OMNodeImpl


Field Summary
protected  OMNodeImpl nextSibling
          Field nextSibling
protected  int nodeType
          Field nodeType
protected  OMContainerEx parent
          Field parent
protected  OMNodeImpl previousSibling
          Field previousSibling
 
Fields inherited from class org.apache.axiom.om.impl.llom.OMSerializableImpl
builder, done, factory
 
Fields inherited from interface org.apache.axiom.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Constructor Summary
OMNodeImpl(OMContainer parent, OMFactory factory, boolean done)
          For a node to exist there must be a parent.
OMNodeImpl(OMFactory factory)
          Constructor OMNodeImpl
 
Method Summary
 void buildWithAttachments()
          Parses this node and builds the object structure in memory.
 OMNode detach()
          Removes this information item and its children, from the model completely.
 OMNode getNextOMSibling()
          Returns the next sibling.
 OMNode getNextOMSiblingIfAvailable()
          Get the next sibling if it is available.
 OMContainer getParent()
          Returns the immediate parent of the node.
 OMNode getPreviousOMSibling()
          Gets the previous sibling.
 int getType()
          Gets the type of node, as this is the super class of all the nodes.
protected  OMNode importNode(OMNode child)
          This method is intended only to be used by Axiom intenals when merging Objects from different Axiom implementations to the LLOM implementation.
 void insertSiblingAfter(OMNode sibling)
          Inserts a sibling just after the current information item.
 void insertSiblingBefore(OMNode sibling)
          Inserts a sibling just before the current information item.
 void internalSerialize(XMLStreamWriter writer)
           
 void internalSerializeAndConsume(XMLStreamWriter writer)
           
 void setComplete(boolean state)
          Method setComplete.
 void setNextOMSibling(OMNode node)
          Method setNextOMSibling.
 void setParent(OMContainer element)
          Method setParent.
 void setPreviousOMSibling(OMNode previousSibling)
          Method setPreviousOMSibling.
 void setType(int nodeType)
          Method setType.
 
Methods inherited from class org.apache.axiom.om.impl.llom.OMSerializableImpl
build, close, getOMFactory, internalSerialize, isComplete, serialize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
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.impl.OMNodeEx
internalSerialize
 
Methods inherited from interface org.apache.axiom.om.OMNode
discard, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 
Methods inherited from interface org.apache.axiom.om.OMSerializable
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
 

Field Detail

parent

protected OMContainerEx parent
Field parent


nextSibling

protected OMNodeImpl nextSibling
Field nextSibling


previousSibling

protected OMNodeImpl previousSibling
Field previousSibling


nodeType

protected int nodeType
Field nodeType

Constructor Detail

OMNodeImpl

public OMNodeImpl(OMFactory factory)
Constructor OMNodeImpl

Parameters:
factory - The OMFactory that created this

OMNodeImpl

public OMNodeImpl(OMContainer parent,
                  OMFactory factory,
                  boolean done)
For a node to exist there must be a parent.

Parameters:
parent - Parent OMContainer of this node
factory - The OMFactory that created this
Method Detail

getParent

public OMContainer getParent()
Returns the immediate parent of the node. Parent is always an Element.

Specified by:
getParent in interface OMNode
Returns:
Returns OMContainer.
Throws:
OMException

setParent

public void setParent(OMContainer element)
Method setParent.

Specified by:
setParent in interface OMNodeEx
Parameters:
element -

getNextOMSibling

public OMNode getNextOMSibling()
                        throws OMException
Returns the next sibling. This can be an OMAttribute or OMText or OMElement for others.

Specified by:
getNextOMSibling in interface OMNode
Returns:
Returns OMNode.
Throws:
OMException

getNextOMSiblingIfAvailable

public OMNode getNextOMSiblingIfAvailable()
Description copied from interface: OMNodeEx
Get the next sibling if it is available. The sibling is available if it is complete or if the builder has started building the node. In the latter case, OMSerializable.isComplete() may return false when called on the sibling. In contrast to OMNode.getNextOMSibling(), this method will never modify the state of the underlying parser.

Specified by:
getNextOMSiblingIfAvailable in interface OMNodeEx
Returns:
the next sibling or null if the node has no next sibling or the builder has not yet started to build the next sibling

setNextOMSibling

public void setNextOMSibling(OMNode node)
Method setNextOMSibling.

Specified by:
setNextOMSibling in interface OMNodeEx
Parameters:
node -

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface OMNodeEx
Specified by:
setComplete in class OMSerializableImpl
Parameters:
state -

detach

public OMNode detach()
              throws OMException
Removes this information item and its children, from the model completely.

Specified by:
detach in interface OMNode
Returns:
The detached node. This is always the instance on which this method is invoked.
Throws:
OMException

insertSiblingAfter

public void insertSiblingAfter(OMNode sibling)
                        throws OMException
Inserts a sibling just after the current information item.

Specified by:
insertSiblingAfter in interface OMNode
Parameters:
sibling -
Throws:
OMException

insertSiblingBefore

public void insertSiblingBefore(OMNode sibling)
                         throws OMException
Inserts a sibling just before the current information item.

Specified by:
insertSiblingBefore in interface OMNode
Parameters:
sibling -
Throws:
OMException

getType

public int getType()
Gets the type of node, as this is the super class of all the nodes.

Specified by:
getType in interface OMNode
Returns:
Returns the type of node as indicated by setType(int)
See Also:
setType(int)

setType

public void setType(int nodeType)
             throws OMException
Method setType.

Specified by:
setType in interface OMNodeEx
Parameters:
nodeType -
Throws:
OMException

getPreviousOMSibling

public OMNode getPreviousOMSibling()
Gets the previous sibling.

Specified by:
getPreviousOMSibling in interface OMNode
Returns:
boolean

setPreviousOMSibling

public void setPreviousOMSibling(OMNode previousSibling)
Method setPreviousOMSibling.

Specified by:
setPreviousOMSibling in interface OMNodeEx
Parameters:
previousSibling -

buildWithAttachments

public void buildWithAttachments()
Parses this node and builds the object structure in memory. AXIOM supports two levels of deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered building of attachments. AXIOM reads in the attachements from the stream only when user asks by calling getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM together with attachement data. This becomes handy when user wants to free the input stream.

Specified by:
buildWithAttachments in interface OMNode

importNode

protected OMNode importNode(OMNode child)
This method is intended only to be used by Axiom intenals when merging Objects from different Axiom implementations to the LLOM implementation.

Parameters:
child -

internalSerialize

public void internalSerialize(XMLStreamWriter writer)
                       throws XMLStreamException
Specified by:
internalSerialize in interface OMNodeEx
Throws:
XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(XMLStreamWriter writer)
                                 throws XMLStreamException
Specified by:
internalSerializeAndConsume in interface OMNodeEx
Throws:
XMLStreamException


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.