- java.lang.Object
-
- com.sun.source.util.TreeScanner<R,P>
-
- com.sun.source.util.TreePathScanner<R,P>
-
- All Implemented Interfaces:
TreeVisitor<R,P>
public class TreePathScanner<R,P> extends TreeScanner<R,P>
A TreeVisitor that visits all the child tree nodes, and provides support for maintaining a path for the parent nodes. To visit nodes of a particular type, just override the corresponding visitorXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes.- Since:
- 1.6
-
-
Constructor Summary
Constructors Constructor Description TreePathScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreePathgetCurrentPath()Returns the current path for the node, as built up by the currently active set of scan calls.Rscan(Tree tree, P p)Scans a single node.Rscan(TreePath path, P p)Scans a tree from a position identified by a TreePath.-
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard
-
-
-
-
Method Detail
-
scan
public R scan(TreePath path, P p)
Scans a tree from a position identified by a TreePath.- Parameters:
path- the path identifying the node to be scannedp- a parameter value passed to visit methods- Returns:
- the result value from the visit method
-
scan
public R scan(Tree tree, P p)
Scans a single node. The current path is updated for the duration of the scan.- Overrides:
scanin classTreeScanner<R,P>- Parameters:
tree- the node to be scannedp- a parameter value passed to the visit method- Returns:
- the result value from the visit method
-
getCurrentPath
public TreePath getCurrentPath()
Returns the current path for the node, as built up by the currently active set of scan calls.- Returns:
- the current path
-
-