モジュール 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>
      戻り値:
      イテレータ。