- java.lang.Object
 -  
      
- com.sun.source.util.Trees
 
 
-  
        
       
-  
             
构造方法摘要
构造方法 构造器 描述 Trees() 
-  
             
方法摘要
所有方法 静态方法 实例方法 抽象方法 具体的方法 变量和类型 方法 描述 abstract StringgetDocComment(TreePath path)返回给定TreePath标识的Tree节点的doc注释(如果有)。abstract ElementgetElement(TreePath path)返回由给定TreePath标识的Tree节点的Element。abstract TypeMirrorgetLub(CatchTree tree)返回catch子句中声明的异常参数的lub。abstract TypeMirrorgetOriginalType(ErrorType errorType)从ErrorType对象返回原始类型。abstract TreePathgetPath(CompilationUnitTree unit, 树 node)返回指定编译单元中树节点的路径。abstract TreePathgetPath(Element e)返回给定Element的TreePath节点。abstract TreePathgetPath(Element e, AnnotationMirror a)返回给定Element上AnnotationMirror的TreePath节点。abstract TreePathgetPath(Element e, AnnotationMirror a, AnnotationValue v)返回给定Element上AnnotationMirror的AnnotationValue的TreePath节点。abstract ScopegetScope(TreePath path)返回给定TreePath标识的Tree节点的Scope。abstract SourcePositionsgetSourcePositions()返回用于获取源位置的实用程序对象。abstract 树getTree(Element element)返回给定Element的Tree节点。abstract 树getTree(Element e, AnnotationMirror a)返回给定Element上AnnotationMirror的Tree节点。abstract 树getTree(Element e, AnnotationMirror a, AnnotationValue v)返回给定Element上AnnotationMirror的AnnotationValue的Tree节点。abstract MethodTreegetTree(ExecutableElement method)返回给定ExecutableElement的MethodTree节点。abstract ClassTreegetTree(TypeElement element)返回给定TypeElement的ClassTree节点。abstract TypeMirrorgetTypeMirror(TreePath path)返回由给定TreePath标识的Tree节点的TypeMirror。static Treesinstance(ProcessingEnvironment env)返回给定ProcessingEnvironment的Trees对象。static Treesinstance(JavaCompiler.CompilationTask task)返回给定CompilationTask的Trees对象。abstract booleanisAccessible(Scope scope, Element member, DeclaredType type)检查给定元素是否可作为给定范围内给定类型的成员访问。abstract booleanisAccessible(Scope scope, TypeElement type)检查给定范围内是否可以访问给定类型。abstract voidprintMessage(Diagnostic.Kind kind, CharSequence msg, 树 t, CompilationUnitTree root)在提供的编译单元中的树的位置打印指定种类的消息 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
instance
public static Trees instance(JavaCompiler.CompilationTask task)
返回给定CompilationTask的Trees对象。- 参数
 -  
              
task- 要获取Trees对象的编译任务 - 结果
 - 树对象
 - 异常
 -  
              
IllegalArgumentException- 如果任务不支持Trees API。 
 
-  
instance
public static Trees instance(ProcessingEnvironment env)
返回给定ProcessingEnvironment的Trees对象。- 参数
 -  
              
env- 获取Trees对象的处理环境 - 结果
 - 树对象
 - 异常
 -  
              
IllegalArgumentException- 如果env不支持Trees API。 
 
-  
getSourcePositions
public abstract SourcePositions getSourcePositions()
返回用于获取源位置的实用程序对象。- 结果
 - 用于获取源位置的实用对象
 
 
-  
getTree
public abstract 树 getTree(Element element)
返回给定Element的Tree节点。 如果找不到节点,则返回null。- 参数
 -  
              
element- 元素 - 结果
 - 树节点
 
 
-  
getTree
public abstract ClassTree getTree(TypeElement element)
返回给定TypeElement的ClassTree节点。 如果找不到节点,则返回null。- 参数
 -  
              
element- 元素 - 结果
 - 类树节点
 
 
-  
getTree
public abstract MethodTree getTree(ExecutableElement method)
返回给定ExecutableElement的MethodTree节点。 如果找不到节点,则返回null。- 参数
 -  
              
method- 可执行元素 - 结果
 - 方法树节点
 
 
-  
getTree
public abstract 树 getTree(Element e, AnnotationMirror a)
返回给定Element上AnnotationMirror的Tree节点。 如果找不到节点,则返回null。- 参数
 -  
              
e- 元素 -  
              
a- 注释镜像 - 结果
 - 树节点
 
 
-  
getTree
public abstract 树 getTree(Element e, AnnotationMirror a, AnnotationValue v)
返回给定Element上AnnotationMirror的AnnotationValue的Tree节点。 如果找不到节点,则返回null。- 参数
 -  
              
e- 元素 -  
              
a- 注释镜像 -  
              
v- 注释值 - 结果
 - 树节点
 
 
-  
getPath
public abstract TreePath getPath(CompilationUnitTree unit, 树 node)
返回指定编译单元中树节点的路径。- 参数
 -  
              
unit- 编译单元 -  
              
node- 树节点 - 结果
 - 树的路径
 
 
-  
getPath
public abstract TreePath getPath(Element e)
返回给定Element的TreePath节点。 如果找不到节点,则返回null。- 参数
 -  
              
e- 元素 - 结果
 - 树的路径
 
 
-  
getPath
public abstract TreePath getPath(Element e, AnnotationMirror a)
返回给定Element上AnnotationMirror的TreePath节点。 如果找不到节点,则返回null。- 参数
 -  
              
e- 元素 -  
              
a- 注释镜像 - 结果
 - 树的路径
 
 
-  
getPath
public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v)
返回给定Element上AnnotationMirror的AnnotationValue的TreePath节点。 如果找不到节点,则返回null。- 参数
 -  
              
e- 元素 -  
              
a- 注释镜像 -  
              
v- 注释值 - 结果
 - 树的路径
 
 
-  
getElement
public abstract Element getElement(TreePath path)
返回由给定TreePath标识的Tree节点的Element。 如果元素不可用,则返回null。- 参数
 -  
              
path- 树路径 - 结果
 - 元素
 - 异常
 -  
              
IllegalArgumentException- TreePath未标识可能具有关联Element的Tree节点。 
 
-  
getTypeMirror
public abstract TypeMirror getTypeMirror(TreePath path)
返回由给定TreePath标识的Tree节点的TypeMirror。 如果TypeMirror不可用,则返回null。- 参数
 -  
              
path- 树路径 - 结果
 - 型镜
 - 异常
 -  
              
IllegalArgumentException- TreePath未标识可能具有关联的TypeMirror的Tree节点。 
 
-  
getScope
public abstract Scope getScope(TreePath path)
返回给定TreePath标识的Tree节点的Scope。 如果范围不可用,则返回null。- 参数
 -  
              
path- 树路径 - 结果
 - 范围
 
 
-  
getDocComment
public abstract String getDocComment(TreePath path)
返回给定TreePath标识的Tree节点的doc注释(如果有)。 如果未找到文档注释,则返回null。- 参数
 -  
              
path- 树路径 - 结果
 - 文档评论
 - 另请参见:
 -  
              
DocTrees.getDocCommentTree(TreePath) 
 
-  
isAccessible
public abstract boolean isAccessible(Scope scope, TypeElement type)
检查给定范围内是否可以访问给定类型。- 参数
 -  
              
scope- 要检查的范围 -  
              
type- 要检查的类型 - 结果
 - 
               如果可访问 
              
type则为true 
 
-  
isAccessible
public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type)
检查给定元素是否可作为给定范围内给定类型的成员访问。- 参数
 -  
              
scope- 要检查的范围 -  
              
member- 要检查的成员 -  
              
type- 要检查成员是否可访问的类型 - 结果
 - 
               如果 
              
member可以在type访问,type 
 
-  
getOriginalType
public abstract TypeMirror getOriginalType(ErrorType errorType)
从ErrorType对象返回原始类型。- 参数
 -  
              
errorType- 我们想要获取原始类型的errorType。 - 结果
 - 与原始类型对应的javax.lang.model.type.TypeMirror,由ErrorType替换。
 
 
-  
printMessage
public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, 树 t, CompilationUnitTree root)
在提供的编译单元中的树的位置打印指定种类的消息- 参数
 -  
              
kind- 那种消息 -  
              
msg- 消息,如果没有,则为空字符串 -  
              
t- 用作位置提示的树 -  
              
root- 包含树的编译单元 
 
-  
getLub
public abstract TypeMirror getLub(CatchTree tree)
返回catch子句中声明的异常参数的lub。- 参数
 -  
              
tree- catch子句的树 - 结果
 - 异常参数的lub
 
 
 -  
 
 -