public class SourceElement extends Object implements Serializable
Constructor and Description |
---|
SourceElement(SourceElementName sourceElementName)
Constructor.
|
SourceElement(String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SourceElement |
copy()
Creates a deep copy of this RichSourceelementImpl object.
|
Object |
getAttribute(SourceAttributeName sourceAttributeName)
Returns the object stored in a given attribute.
|
Object |
getAttribute(String name)
Returns the object stored in a given attribute.
|
Set<String> |
getAttributeNames()
Returns the name of all set attributes.
|
SourceElement |
getChild(SourceElementName sourceElementName)
Returns the first child of this SourceElement which has
the given name.
|
SourceElement |
getChild(String name)
Returns the first child of this SourceElement which has
the given name.
|
List<SourceElement> |
getChildren()
Returns all children of this SourceElement.
|
List<SourceElement> |
getChildren(SourceElementName sourceElementName)
Returns all children of this SourceElement which have the given name.
|
List<SourceElement> |
getChildren(String name)
Returns all children of this SourceElement which have the given name.
|
SourceElement |
getFirstChild()
Returns the first child of this source element.
|
List<SourceElement> |
getFollowing(String name)
Returns all the following elements after this element
with the given name.
|
SourceElement |
getFollowingSourceElement(SourceElement parent)
Returns the following element after this element
If this element has no parent, null is returned.
|
SourceElement |
getLastChild()
Returns the last child of this source element.
|
String |
getName()
Returns the name of this source element.
|
SourceElement |
getParent()
Returns the primary parent of this SourceElement.
|
List<SourceElement> |
getParents()
Returns the list of parents of this SourceElement.
|
List<SourceElement> |
getPreceding(String name)
Returns all the preceding elements before this element
with the given name.
|
SourceElement |
getPrecedingSourceElement(SourceElement parent)
Returns the preceding element after this element.
|
Object |
getTextAttribute()
Returns the object stored in the attribute with key null.
|
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.
|
boolean |
hasChild(String name)
Returns whether children with the given name exist.
|
boolean |
hasFollowing()
Returns whether a following element exists as a child of the parent of
this element.
|
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.
|
boolean |
hasPreceding()
Returns whether an preceding exists as a child of the parent of
this element.
|
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.
|
Object |
setAttribute(SourceAttributeName sourceAttributeName,
Object value)
Sets the attribute of a Source element.
|
Object |
setAttribute(String name,
Object value)
Sets the attribute of a Source element.
|
String |
toString() |
public SourceElement(String name)
name
- the name of the element, not null.NullPointerException
- if name is null.public SourceElement(SourceElementName sourceElementName)
sourceElementName
- sourceElementName name of the element, not null.NullPointerException
- if sourceElementName is null.public String getName()
public SourceElement getParent()
public List<SourceElement> getParents()
public List<SourceElement> getChildren()
public List<SourceElement> getChildren(String name)
name
- the name of the children to select, not null.NullPointerException
- if name is null.public List<SourceElement> getChildren(SourceElementName sourceElementName)
sourceElementName
- contains the name of the child to select,
not null.NullPointerException
- if sourceElementName is null.public SourceElement getChild(String name)
name
- the name of the child to select, not null.NullPointerException
- if name is null.public SourceElement getChild(SourceElementName sourceElementName)
sourceElementName
- contains the name of the child to select,
not null.NullPointerException
- if sourceElementName is null.public boolean hasChild(String name)
name
- the name of the child element, not null.NullPointerException
- if name is null.public SourceElement getFirstChild()
public SourceElement getLastChild()
public List<SourceElement> getFollowing(String name)
public SourceElement getFollowingSourceElement(SourceElement parent)
parent
- the parent of this source Element in which child
list the following element should be looked for.IllegalArgumentException
- if parent is not a parent
of this SourceElement.public boolean hasFollowing()
public boolean hasPreceding()
public boolean hasFollowingSibling()
public boolean hasPrecedingSibling()
public List<SourceElement> getPreceding(String name)
public SourceElement getPrecedingSourceElement(SourceElement parent)
parent
- the parent of this source Element in which child
list the following element should be looked for.IllegalArgumentException
- if parent is not a parent
of this SourceElement.public Object getTextAttribute()
public Object getAttribute(String name)
name
- the name of the attribute, can be null.public Object getAttribute(SourceAttributeName sourceAttributeName)
sourceAttributeName
- contains the name of the attribute, not null.NullPointerException
- if sourceAttributeName is null.public Object setAttribute(String name, Object value)
name
- the name of the attribute.value
- the value of the attribute,
or null to remove the attribute.public Object setAttribute(SourceAttributeName sourceAttributeName, Object value)
sourceAttributeName
- contains the name of the attribute, not null.value
- the value of the attribute,
or null to remove the attribute.public Set<String> getAttributeNames()
public SourceElement copy()
public boolean graphEquals(SourceElement toCompare)
toCompare
- the source element to compare, may be null.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.