モジュール jdk.compiler
パッケージ com.sun.source.util

クラスTreePath

java.lang.Object
com.sun.source.util.TreePath
すべての実装されたインタフェース:
Iterable<Tree>

public class TreePath extends Object implements Iterable<Tree>
ツリー・ノードのパスです。通常、トップ・レベルのCompilationUnitTreeノードまでの、ツリー・ノードの上位ノードのシーケンスを表すために使用されます。
導入されたバージョン:
1.6
  • コンストラクタの詳細

    • TreePath

      public TreePath(CompilationUnitTree node)
      ルート・ノードのTreePathを作成します。
      パラメータ:
      node - ルート・ノード
    • TreePath

      public TreePath(TreePath path, Tree tree)
      子ノードのTreePathを作成します。
      パラメータ:
      path - 親パス
      tree - 子ノード
  • メソッドの詳細

    • getPath

      public static TreePath getPath(CompilationUnitTree unit, Tree target)
      コンパイル単位内のツリー・ノードのツリー・パスを返します。ノードが見つからない場合はnullを返します。
      パラメータ:
      unit - 検索するコンパイル単位
      target - 見つけ出すノード
      戻り値:
      ツリー・パス
    • getPath

      public static TreePath getPath(TreePath path, Tree target)
      TreePathオブジェクトによって識別されるサブツリー内のツリー・ノードのツリー・パスを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      path - 検索するパス
      target - 見つけ出すノード
      戻り値:
      ターゲット・ノードのツリー・パス
    • getCompilationUnit

      public CompilationUnitTree getCompilationUnit()
      このパスに関連付けられたコンパイル単位を返します。
      戻り値:
      コンパイル単位
    • getLeaf

      public Tree getLeaf()
      このパスのリーフ・ノードを返します。
      戻り値:
      リーフ・ノード
    • getParentPath

      public TreePath getParentPath()
      囲むノードのパスを返します。囲むノードがない場合はnullを返します。
      戻り値:
      包含ノードのパス
    • iterator

      public Iterator<Tree> iterator()
      リーフからルートまで繰り返します。
      定義:
      iterator 、インタフェース: Iterable<Tree>
      戻り値:
      イテレータ。