org.teiid.query.mapping.xml
Class MappingNode

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

public abstract class MappingNode
extends Object
implements Cloneable, 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.
 MappingNode clone()
           
 boolean equals(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, String partialName)
           
 List<MappingNode> getChildren()
          Get the children contained by this node, or an empty List
 List<MappingNode> getChildren(String type)
          Get all children of this node of a specified target node type.
 ElementSymbol getElementSymbol()
           
 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.
 String getName()
           
 String getNameInSource()
           
 List<MappingNode> getNodeChildren()
           
 Map<MappingNodeConstants.Properties,Object> getNodeProperties()
          Returns the actual local properties object, instantiates if necessary.
 MappingNode getParent()
          Get the parent of this node.
 String getPathName()
           
 Object getProperty(MappingNodeConstants.Properties 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, PrintStream output)
          Prints the whole tree of MappingNodes to the provided PrintStream.
 MappingNode setExclude(boolean exclude)
           
 String toString()
          Returns a string representation of an instance of this class.
static String toStringNodeTree(MappingNode root)
           
 
Methods inherited from class java.lang.Object
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,
                                   String partialName)

getChildren

public List<MappingNode> getChildren()
Get the children contained by this node, or an empty List

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

getChildren

public List<MappingNode> getChildren(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 List<MappingNode> 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 Object getProperty(MappingNodeConstants.Properties 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 Map<MappingNodeConstants.Properties,Object> 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 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 String getName()

getPathName

public String getPathName()

equals

public boolean equals(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 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 Object
Returns:
Hash code

toString

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

Overrides:
toString in class Object

printMappingNodeTree

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


toStringNodeTree

public static 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 String getNameInSource()

clone

public MappingNode clone()
Overrides:
clone in class Object

getElementSymbol

public ElementSymbol getElementSymbol()


Copyright © 2011. All Rights Reserved.