Module jdk.compiler

Class DocTreePath

java.lang.Object
com.sun.source.util.DocTreePath
所有已实现的接口:
Iterable<DocTree>

public class DocTreePath extends Object implements Iterable<DocTree>
树节点路径,通常用于表示树节点的祖先节点序列,直到顶层DocCommentTree节点。
自版本:
1.8
  • Constructor Details

    • DocTreePath

      public DocTreePath(TreePath treePath, DocCommentTree t)
      为根节点创建一个DocTreePath
      参数:
      treePath - 创建根节点的TreePath
      t - 要为其创建路径的DocCommentTree
    • DocTreePath

      public DocTreePath(DocTreePath p, DocTree t)
      为子节点创建一个DocTreePath
      参数:
      p - 父节点
      t - 子节点
  • Method Details

    • getPath

      public static DocTreePath getPath(TreePath treePath, DocCommentTree doc, DocTree target)
      返回编译单元中树节点的文档树路径,如果未找到节点则返回null
      参数:
      treePath - 与文档注释关联的节点的路径
      doc - 与节点关联的文档注释
      target - 文档注释中的一个节点
      返回:
      标识树中目标的路径
    • getPath

      public static DocTreePath getPath(DocTreePath path, DocTree target)
      返回由DocTreePath对象标识的子树中树节点的文档树路径,如果未找到节点则返回null
      参数:
      path - 标识文档注释树中节点的路径
      target - 要在给定节点中定位的节点
      返回:
      标识目标节点的路径
    • getTreePath

      public TreePath getTreePath()
      返回与此路径关联的TreePath
      返回:
      DocTreePathTreePath
    • getDocComment

      public DocCommentTree getDocComment()
      返回与此路径关联的DocCommentTree
      返回:
      DocTreePathDocCommentTree
    • getLeaf

      public DocTree getLeaf()
      返回此路径的叶节点。
      返回:
      DocTreePathDocTree
    • getParentPath

      public DocTreePath getParentPath()
      返回封闭节点的路径,如果没有封闭节点则返回null
      返回:
      父节点的DocTreePath
    • iterator

      public Iterator<DocTree> iterator()
      从接口复制的描述: Iterable
      返回类型为T的元素的迭代器。
      指定者:
      iterator 在接口 Iterable<DocTree>
      返回:
      一个迭代器。