TreePathScannerpublic class TreePathScanner extends TreeScanner 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. |
Fields Summary |
---|
private TreePath | path |
Methods Summary |
---|
public com.sun.source.util.TreePath | getCurrentPath()Get the current path for the node, as built up by the currently
active set of scan calls.
return path;
| public R | scan(com.sun.source.util.TreePath path, P p)Scan a tree from a position identified by a TreePath.
this.path = path;
try {
return path.getLeaf().accept(this, p);
} finally {
this.path = null;
}
| public R | scan(com.sun.source.tree.Tree tree, P p)Scan a single node.
The current path is updated for the duration of the scan.
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
|
|