com.metamatrix.query.mapping.xml
Class MappingNode

java.lang.Object
  extended by com.metamatrix.query.mapping.xml.MappingNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MappingAttribute, MappingBaseNode, MappingCommentNode

public abstract class MappingNode
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

There will be a mapping node for every entity (element or attribute) in a target XML document.

See Also:
MappingNodeConstants, Serialized Form

Constructor Summary
MappingNode()
          default constructor
 
Method Summary
abstract  void acceptVisitor(MappingVisitor visitor)
           
 MappingNode addChild(MappingNode node)
          Add a child mapping node to this one.
 boolean equals(java.lang.Object obj)
          Compare the symbol based ONLY on properties (including name), NOT on parent node and children nodes (or lack thereof).
static MappingNode findNode(MappingNode root, java.lang.String partialName)
           
 java.util.List getChildren()
          Get the children contained by this node, or an empty List
 java.util.List getChildren(java.lang.String type)
          Get all children of this node of a specified target node type.
 java.lang.String getFullyQualifiedName()
          Gets the fully qualified name of this node, this is obtained by concatenating the nodes name to the parents qualified name with a delimiter in between them.
 java.lang.String getName()
           
 java.lang.String getNameInSource()
           
 java.util.List getNodeChildren()
           
 java.util.Map getNodeProperties()
          Returns the actual local properties object, instantiates if necessary.
 MappingNode getParent()
          Get the parent of this node.
 java.lang.String getPathName()
           
 java.lang.Object getProperty(java.lang.Integer propertyID)
          Retrieve one of the Object values, keyed off the Integer property keys defined in MappingNodeConstants.Properties
 MappingSourceNode getSourceNode()
          Get the source node for this Mapping Node; note that only mapping elements and mapping attributes have the source nodes; that too ones with specified with NameInSource specified attribute.
 int hashCode()
          Return a hash code for this symbol.
 boolean isExcluded()
           
static void printMappingNodeTree(MappingNode root, java.io.PrintStream output)
          Prints the whole tree of MappingNodes to the provided PrintStream.
 MappingNode setExclude(boolean exclude)
           
 java.lang.String toString()
          Returns a string representation of an instance of this class.
static java.lang.String toStringNodeTree(MappingNode root)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MappingNode

public MappingNode()
default constructor

Method Detail

getParent

public MappingNode getParent()
Get the parent of this node.


findNode

public static MappingNode findNode(MappingNode root,
                                   java.lang.String partialName)

getChildren

public java.util.List getChildren()
Get the children contained by this node, or an empty List

Returns:
children; if no children, return empty List (never null)

getChildren

public java.util.List getChildren(java.lang.String type)
Get all children of this node of a specified target node type. The value of node type should be one of #ATTRIBUTE or #ELEMENT.


getNodeChildren

public java.util.List getNodeChildren()

addChild

public MappingNode addChild(MappingNode node)
Add a child mapping node to this one.

Parameters:
MappingNode - to add as a child of this node
Returns:
the added node, with parent set to this node

getProperty

public java.lang.Object getProperty(java.lang.Integer propertyID)
Retrieve one of the Object values, keyed off the Integer property keys defined in MappingNodeConstants.Properties

Parameters:
propertyID - Integer property key
Returns:
Object value

getNodeProperties

public java.util.Map getNodeProperties()
Returns the actual local properties object, instantiates if necessary. The Map returned is the basis for equality for a MappingNode. Note: Use #getProperties unless absolutely necessary.

Returns:
the actual properties (not including defaults) stored at this object.
See Also:
#getProperties

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()

Gets the fully qualified name of this node, this is obtained by concatenating the nodes name to the parents qualified name with a delimiter in between them.

Returns:
The fully qualified name of this node.

getName

public java.lang.String getName()

getPathName

public java.lang.String getPathName()

equals

public boolean equals(java.lang.Object obj)
Compare the symbol based ONLY on properties (including name), NOT on parent node and children nodes (or lack thereof).

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object
Returns:
True if other obj is a MappingNode (or subclass) and properties are equal

hashCode

public int hashCode()
Return a hash code for this symbol.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code

toString

public java.lang.String toString()
Returns a string representation of an instance of this class.

Overrides:
toString in class java.lang.Object

printMappingNodeTree

public static void printMappingNodeTree(MappingNode root,
                                        java.io.PrintStream output)
Prints the whole tree of MappingNodes to the provided PrintStream.


toStringNodeTree

public static java.lang.String toStringNodeTree(MappingNode root)

setExclude

public MappingNode setExclude(boolean exclude)

isExcluded

public boolean isExcluded()

acceptVisitor

public abstract void acceptVisitor(MappingVisitor visitor)

getSourceNode

public MappingSourceNode getSourceNode()
Get the source node for this Mapping Node; note that only mapping elements and mapping attributes have the source nodes; that too ones with specified with NameInSource specified attribute. If not find nearest one looking up the tree.

Returns:

getNameInSource

public java.lang.String getNameInSource()


Copyright © 2009. All Rights Reserved.