public class TreePath extends Object implements Iterable<Tree>
CompilationUnitTree
node.Constructor | Description |
---|---|
TreePath |
Creates a TreePath for a root node. |
TreePath |
Creates a TreePath for a child node. |
Modifier and Type | Method | Description |
---|---|---|
CompilationUnitTree |
getCompilationUnit() |
Returns the compilation unit associated with this path. |
Tree |
getLeaf() |
Returns the leaf node for this path. |
TreePath |
getParentPath() |
Returns the path for the enclosing node, or null if there is no enclosing node. |
static TreePath |
getPath |
Returns a tree path for a tree node within a compilation unit, or null if the node is not found. |
static TreePath |
getPath |
Returns a tree path for a tree node within a subtree identified by a TreePath object. |
Iterator |
iterator() |
Iterates from leaves to root. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TreePath(CompilationUnitTree node)
node
- the root nodepublic TreePath(TreePath path, Tree tree)
path
- the parent pathtree
- the child nodepublic static TreePath getPath(CompilationUnitTree unit, Tree target)
null
if the node is not found.unit
- the compilation unit to searchtarget
- the node to locatepublic static TreePath getPath(TreePath path, Tree target)
null
if the node is not found.path
- the path in which to searchtarget
- the node to locatepublic CompilationUnitTree getCompilationUnit()
public Tree getLeaf()
public TreePath getParentPath()
null
if there is no enclosing node.public Iterator<Tree> iterator()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/util/TreePath.html