Package net.sourceforge.pmd.lang.ast
Interface TextAvailableNode
-
- All Superinterfaces:
Node
,Reportable
- All Known Subinterfaces:
JjtreeNode<N>
- All Known Implementing Classes:
AbstractJjtreeNode
public interface TextAvailableNode extends Node
Refinement ofNode
for nodes that can provide the underlying source text.- Since:
- 7.0.0
-
-
Field Summary
-
Fields inherited from interface net.sourceforge.pmd.lang.ast.Node
COORDS_COMPARATOR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Chars
getOriginalText()
Returns the original source code underlying this node, before any escapes have been translated.default Chars
getText()
Returns the source code underlying this node, after any escapes have been translated.TextRegion
getTextRegion()
Returns the exact region of text delimiting the node in the underlying text document.-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
acceptVisitor, ancestors, ancestors, ancestorsOrSelf, asStream, children, children, compareLocation, descendants, descendants, descendantsOrSelf, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, firstChild, getAstInfo, getBeginColumn, getBeginLine, getChild, getEndColumn, getEndLine, getFirstChild, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfType, getImage, getIndexInParent, getLanguageVersion, getLastChild, getNextSibling, getNthParent, getNumChildren, getParent, getParentsOfType, getPreviousSibling, getReportLocation, getRoot, getTextDocument, getUserMap, getXPathAttributesIterator, getXPathNodeName, hasDescendantOfType, hasImageEqualTo, isFindBoundary
-
-
-
-
Method Detail
-
getTextRegion
TextRegion getTextRegion()
Returns the exact region of text delimiting the node in the underlying text document. Note thatNode.getReportLocation()
does not need to match this region.Node.getReportLocation()
can be scoped down to a specific token, eg the class identifier. This region uses the translated coordinate system, ie the coordinate system ofNode.getTextDocument()
.- Specified by:
getTextRegion
in interfaceNode
-
getOriginalText
default Chars getOriginalText()
Returns the original source code underlying this node, before any escapes have been translated. In particular, for aRootNode
, returns the whole text of the file.
-
-