Compiler Tree API

Class TreePathScanner<R,P>

  extended by com.sun.source.util.TreeScanner<R,P>
      extended by com.sun.source.util.TreePathScanner<R,P>
All Implemented Interfaces:

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.


Constructor Summary
Method Summary
 TreePath getCurrentPath()
          Get the current path for the node, as built up by the currently active set of scan calls.
 R scan(Tree tree, P p)
          Scan a single node.
 R scan(TreePath path, P p)
          Scan a tree from a position identified by a TreePath.
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitLabeledStatement, visitLiteral, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitNewArray, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, visitWhileLoop, visitWildcard
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public TreePathScanner()
Method Detail


public R scan(TreePath path,
              P p)
Scan a tree from a position identified by a TreePath.


public R scan(Tree tree,
              P p)
Scan a single node. The current path is updated for the duration of the scan.

scan in class TreeScanner<R,P>


public TreePath getCurrentPath()
Get the current path for the node, as built up by the currently active set of scan calls.

Compiler Tree API

Submit a bug or feature
Copyright © 2005, 2011, Oracle and/or its affiliates. All rights reserved.