Klasse SourceElement

java.lang.Object
org.apache.torque.generator.source.SourceElement
Alle implementierten Schnittstellen:
Serializable

public class SourceElement extends Object implements Serializable
An element in the source graph.
Siehe auch:
  • Konstruktordetails

    • SourceElement

      public SourceElement(String name)
      Constructor.
      Parameter:
      name - the name of the element, not null.
      Löst aus:
      NullPointerException - if name is null.
    • SourceElement

      public SourceElement(SourceElementName sourceElementName)
      Constructor.
      Parameter:
      sourceElementName - sourceElementName name of the element, not null.
      Löst aus:
      NullPointerException - if sourceElementName is null.
  • Methodendetails

    • getName

      public String getName()
      Returns the name of this source element.
      Gibt zurück:
      the name of this source element, never null.
    • getParent

      public SourceElement getParent()
      Returns the primary parent of this SourceElement.
      Gibt zurück:
      the primary parent of this SourceElement, or null if this is a root element of the source graph.
    • getParents

      public List<SourceElement> getParents()
      Returns the list of parents of this SourceElement. Parents can be added and removed via the methods exposed by the returned list.
      Gibt zurück:
      the list of parents of this source element, never null.
    • getChildren

      public List<SourceElement> getChildren()
      Returns all children of this SourceElement. Children can be added and removed via the methods exposed by the returned list.
      Gibt zurück:
      the list of children of this source element, never null.
    • getChildren

      public List<SourceElement> getChildren(String name)
      Returns all children of this SourceElement which have the given name. Modifications on the returned list have no effect on the list of children of this SourceElement.
      Parameter:
      name - the name of the children to select, not null.
      Gibt zurück:
      the list of children of this source element with the given name, never null.
      Löst aus:
      NullPointerException - if name is null.
    • getChildren

      public List<SourceElement> getChildren(SourceElementName sourceElementName)
      Returns all children of this SourceElement which have the given name. Modifications on the returned list have no effect on the list of children of this SourceElement.
      Parameter:
      sourceElementName - contains the name of the child to select, not null.
      Gibt zurück:
      the list of children of this source element with the given name, never null.
      Löst aus:
      NullPointerException - if sourceElementName is null.
    • getChild

      public SourceElement getChild(String name)
      Returns the first child of this SourceElement which has the given name.
      Parameter:
      name - the name of the child to select, not null.
      Gibt zurück:
      the first child with the given name, or null if no child with the given name exits.
      Löst aus:
      NullPointerException - if name is null.
    • getChild

      public SourceElement getChild(SourceElementName sourceElementName)
      Returns the first child of this SourceElement which has the given name.
      Parameter:
      sourceElementName - contains the name of the child to select, not null.
      Gibt zurück:
      the first child with the given name, or null if no child with the given name exits.
      Löst aus:
      NullPointerException - if sourceElementName is null.
    • hasChild

      public boolean hasChild(String name)
      Returns whether children with the given name exist.
      Parameter:
      name - the name of the child element, not null.
      Gibt zurück:
      true if children with the given name exist, false otherwise.
      Löst aus:
      NullPointerException - if name is null.
    • getFirstChild

      public SourceElement getFirstChild()
      Returns the first child of this source element.
      Gibt zurück:
      the first child, or null if this source element has no children.
    • getLastChild

      public SourceElement getLastChild()
      Returns the last child of this source element.
      Gibt zurück:
      the last child, or null if this source element has no children.
    • getFollowing

      public List<SourceElement> getFollowing(String name)
      Returns all the following elements after this element with the given name. If name is null, all following elements are returned. If this element has no parent, an empty list is returned.
      Parameter:
      name - the name of the following elements to select, or null to select all following elements.
      Gibt zurück:
      a list containing the following elements with the given name, never null.
      Siehe auch:
    • getFollowingSourceElement

      public SourceElement getFollowingSourceElement(SourceElement parent)
      Returns the following element after this element If this element has no parent, null is returned.
      Parameter:
      parent - the parent of this source Element in which child list the following element should be looked for.
      Gibt zurück:
      the following source element, or null if no following source element exists.
      Löst aus:
      IllegalArgumentException - if parent is not a parent of this SourceElement.
    • hasFollowing

      public boolean hasFollowing()
      Returns whether a following element exists as a child of the parent of this element.
      Gibt zurück:
      true if a following element exists, false if not.
    • hasPreceding

      public boolean hasPreceding()
      Returns whether an preceding exists as a child of the parent of this element.
      Gibt zurück:
      true if a preceding element exists, false if not.
    • hasFollowingSibling

      public boolean hasFollowingSibling()
      Returns whether a following element exists as a child of the parent of this element, which has the same name as this source element.
      Gibt zurück:
      true if a following sibling exists, false if not.
    • hasPrecedingSibling

      public boolean hasPrecedingSibling()
      Returns whether an preceding exists as a child of the parent of this element, which has the same name as this source element.
      Gibt zurück:
      true if a preceding sibling exists, false if not.
    • getPreceding

      public List<SourceElement> getPreceding(String name)
      Returns all the preceding elements before this element with the given name. If name is null, all preceding elements are returned. If this element has no parent, an empty list is returned.
      Parameter:
      name - the name of the preceding elements to select, or null to select all preceding elements.
      Gibt zurück:
      a list containing the following elements with the given name, never null.
      Siehe auch:
    • getPrecedingSourceElement

      public SourceElement getPrecedingSourceElement(SourceElement parent)
      Returns the preceding element after this element. If this element has no parent, null is returned.
      Parameter:
      parent - the parent of this source Element in which child list the following element should be looked for.
      Gibt zurück:
      the preceding source element, or null if no preceding source element exists.
      Löst aus:
      IllegalArgumentException - if parent is not a parent of this SourceElement.
    • getTextAttribute

      public Object getTextAttribute()
      Returns the object stored in the attribute with key null.
      Gibt zurück:
      the stored object, or null if no object is stored under the key null.
    • getAttribute

      public Object getAttribute(String name)
      Returns the object stored in a given attribute.
      Parameter:
      name - the name of the attribute, can be null.
      Gibt zurück:
      the stored object, or null if no object is stored under that key.
    • getAttribute

      public Object getAttribute(SourceAttributeName sourceAttributeName)
      Returns the object stored in a given attribute.
      Parameter:
      sourceAttributeName - contains the name of the attribute, not null.
      Gibt zurück:
      the stored object, or null if no object is stored under that key.
      Löst aus:
      NullPointerException - if sourceAttributeName is null.
    • setAttribute

      public Object setAttribute(String name, Object value)
      Sets the attribute of a Source element.
      Parameter:
      name - the name of the attribute.
      value - the value of the attribute, or null to remove the attribute.
      Gibt zurück:
      the previous value of this attribute.
    • setAttribute

      public Object setAttribute(SourceAttributeName sourceAttributeName, Object value)
      Sets the attribute of a Source element.
      Parameter:
      sourceAttributeName - contains the name of the attribute, not null.
      value - the value of the attribute, or null to remove the attribute.
      Gibt zurück:
      the previous value of this attribute.
    • getAttributeNames

      public Set<String> getAttributeNames()
      Returns the name of all set attributes. Note : null may be contained in the set.
      Gibt zurück:
      the name of all set values.
    • copy

      public SourceElement copy()
      Creates a deep copy of this RichSourceelementImpl object. All the elements in the source graph of this Element are copied as well (i.e the copy contains the children, the children's children, ...., the parents, the parent's parents...)
      Gibt zurück:
      the copy, not null.
    • graphEquals

      public boolean graphEquals(SourceElement toCompare)
      Checks whether the source element graph of this sourceElement, and its position therein, equals the source element graph and the position of the provided SourceElement. This is an expensive operation if the graphs are large.
      Parameter:
      toCompare - the source element to compare, may be null.
      Gibt zurück:
      true if all source elements in the toCompare tree have the equal content as the source elements in this tree.
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object