Class ElementNode
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.xpath.AbstractNode
-
- com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode
-
- com.puppycrawl.tools.checkstyle.xpath.ElementNode
-
- All Implemented Interfaces:
Source
,SourceLocator
,net.sf.saxon.lib.ActiveSource
,net.sf.saxon.om.GroundedValue
,net.sf.saxon.om.Item
,net.sf.saxon.om.NodeInfo
,net.sf.saxon.om.Sequence
,net.sf.saxon.s9api.Location
,Locator
public class ElementNode extends AbstractElementNode
Represents DetailAST's element node of Xpath-tree.
-
-
Field Summary
Fields Modifier and Type Field Description private DetailAST
detailAst
The ast node.-
Fields inherited from class com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode
TEXT_ATTRIBUTE_NAME
-
-
Constructor Summary
Constructors Constructor Description ElementNode(AbstractNode root, AbstractNode parent, DetailAST detailAst, int depth, int indexAmongSiblings)
Creates a newElementNode
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AttributeNode
createAttributeNode()
CreatesAttributeNode
object and returns it.protected List<AbstractNode>
createChildren()
Iterates children of the current node and recursively creates new Xpath-nodes.int
getColumnNumber()
Returns column number.int
getLineNumber()
Returns line number.String
getLocalPart()
Returns local part.int
getTokenType()
Getter method for token type.DetailAST
getUnderlyingNode()
Returns underlying node.boolean
hasChildNodes()
Determine whether the node has any children.-
Methods inherited from class com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode
compareOrder, getAttributeValue, getDepth, getNodeKind, getParent, getRoot, iterateAxis
-
Methods inherited from class com.puppycrawl.tools.checkstyle.xpath.AbstractNode
atomize, copy, generateId, getAllNamespaces, getBaseURI, getChildren, getConfiguration, getDeclaredNamespaces, getDisplayName, getFingerprint, getNamespaceUri, getPrefix, getPublicId, getSchemaType, getStringValue, getSystemId, getTreeInfo, getUnicodeStringValue, getURI, hasFingerprint, isId, isIdref, isNilled, isSameNodeInfo, isStreamed, iterateAxis, saveLocation, setSystemId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, head, itemAt, iterate, reduce, subsequence
-
-
-
-
Constructor Detail
-
ElementNode
public ElementNode(AbstractNode root, AbstractNode parent, DetailAST detailAst, int depth, int indexAmongSiblings)
Creates a newElementNode
instance.- Parameters:
root
-Node
root of the treeparent
-Node
parent of the current nodedetailAst
- reference toDetailAST
depth
- the current node depth in the hierarchyindexAmongSiblings
- the current node index among the parent children nodes
-
-
Method Detail
-
createChildren
protected List<AbstractNode> createChildren()
Iterates children of the current node and recursively creates new Xpath-nodes.- Specified by:
createChildren
in classAbstractNode
- Returns:
- children list
-
hasChildNodes
public boolean hasChildNodes()
Determine whether the node has any children.- Returns:
true
is the node has any children.
-
getLocalPart
public String getLocalPart()
Returns local part.- Returns:
- local part
-
getLineNumber
public int getLineNumber()
Returns line number.- Returns:
- line number
-
getColumnNumber
public int getColumnNumber()
Returns column number.- Returns:
- column number
-
getTokenType
public int getTokenType()
Getter method for token type.- Specified by:
getTokenType
in classAbstractNode
- Returns:
- token type
-
getUnderlyingNode
public DetailAST getUnderlyingNode()
Returns underlying node.- Specified by:
getUnderlyingNode
in classAbstractNode
- Returns:
- underlying node
-
createAttributeNode
protected AttributeNode createAttributeNode()
Description copied from class:AbstractElementNode
CreatesAttributeNode
object and returns it.- Specified by:
createAttributeNode
in classAbstractElementNode
- Returns:
- attribute node if possible, otherwise the
null
value
-
-