java.lang.Object
com.sun.source.util.Trees
- 已知子类:
DocTrees
桥接 JSR 199、JSR 269 和 Tree API。
-
构造方法总结
构造方法 -
方法总结
修饰符和类型方法描述abstract StringgetDocComment(TreePath path) 返回给定TreePath标识的Tree节点的文档注释(如果有)。abstract ElementgetElement(TreePath path) 返回由给定的TreePath标识的Tree节点的Element。abstract TypeMirror返回在 catch 子句中声明的异常参数的 lub。abstract TypeMirrorgetOriginalType(ErrorType errorType) 从ErrorType对象返回原始类型。abstract TreePathgetPath(CompilationUnitTree unit, Tree node) 返回指定编译单元内树节点的路径。abstract TreePath返回给定Element的TreePath节点。abstract TreePathgetPath(Element e, AnnotationMirror a) 返回给定Element上AnnotationMirror的TreePath节点。abstract TreePathgetPath(Element e, AnnotationMirror a, AnnotationValue v) 为给定的Element上的AnnotationMirror返回AnnotationValue的TreePath节点。abstract Scope返回由给定的TreePath标识的Tree节点的Scope。abstract SourcePositions返回用于获取源位置的实用程序对象。abstract Tree返回给定Element的Tree节点。abstract TreegetTree(Element e, AnnotationMirror a) 返回给定Element上AnnotationMirror的Tree节点。abstract TreegetTree(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 Trees为给定的ProcessingEnvironment返回一个Trees对象。static Trees为给定的CompilationTask返回一个Trees对象。abstract booleanisAccessible(Scope scope, Element member, DeclaredType type) 检查给定元素是否可以作为给定范围内给定类型的成员访问。abstract booleanisAccessible(Scope scope, TypeElement type) 检查给定类型在给定范围内是否可访问。abstract voidprintMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root) 在提供的编译单元内的树的位置打印指定类型的消息
-
构造方法详细信息
-
Trees
public Trees()子类调用的构造方法。
-
-
方法详情
-
instance
为给定的CompilationTask返回一个Trees对象。- 参数:
task- 为其获取Trees对象的编译任务- 返回:
Trees对象- 抛出:
IllegalArgumentException- 如果任务不支持 Tree API。
-
instance
为给定的ProcessingEnvironment返回一个Trees对象。- 参数:
env- 获取Trees对象的处理环境- 返回:
Trees对象- 抛出:
IllegalArgumentException- 如果环境不支持 Tree API。
-
getSourcePositions
返回用于获取源位置的实用程序对象。- 返回:
- 获取源位置的实用对象
-
getTree
返回给定Element的Tree节点。如果找不到节点,则返回null。- 参数:
element- 元素- 返回:
- 树节点
-
getTree
返回给定TypeElement的ClassTree节点。如果找不到节点,则返回null。- 参数:
element- 元素- 返回:
- 类树节点
-
getTree
返回给定ExecutableElement的MethodTree节点。如果找不到节点,则返回null。- 参数:
method- 可执行元素- 返回:
- 方法树节点
-
getTree
返回给定Element上AnnotationMirror的Tree节点。如果找不到节点,则返回null。- 参数:
e- 元素a- 注释镜像- 返回:
- 树节点
-
getTree
为给定的Element上的AnnotationMirror返回AnnotationValue的Tree节点。如果找不到节点,则返回null。- 参数:
e- 元素a- 注释镜像v- 注解值- 返回:
- 树节点
-
getPath
返回指定编译单元内树节点的路径。- 参数:
unit- 编译单元node- 树节点- 返回:
- 树路径
-
getPath
返回给定Element的TreePath节点。如果找不到节点,则返回null。- 参数:
e- 元素- 返回:
- 树路径
-
getPath
返回给定Element上AnnotationMirror的TreePath节点。如果找不到节点,则返回null。- 参数:
e- 元素a- 注释镜像- 返回:
- 树路径
-
getPath
为给定的Element上的AnnotationMirror返回AnnotationValue的TreePath节点。如果找不到节点,则返回null。- 参数:
e- 元素a- 注释镜像v- 注解值- 返回:
- 树路径
-
getElement
返回由给定的TreePath标识的Tree节点的Element。如果元素不可用,则返回null。- 参数:
path- 树路径- 返回:
- 元素
- 抛出:
IllegalArgumentException- 是TreePath未识别可能具有关联的Element的Tree节点。
-
getTypeMirror
返回由给定的TreePath标识的Tree节点的TypeMirror。如果TypeMirror不可用,则返回null。- 参数:
path- 树路径- 返回:
- 镜像类型
- 抛出:
IllegalArgumentException- 是TreePath未识别可能具有关联的TypeMirror的Tree节点。
-
getScope
返回由给定的TreePath标识的Tree节点的Scope。如果Scope不可用,则返回null。- 参数:
path- 树路径- 返回:
- 范围
-
getDocComment
返回给定TreePath标识的Tree节点的文档注释(如果有)。如果未找到文档注释,则返回null。- 参数:
path- 树路径- 返回:
- 文档评论
- 参见:
-
isAccessible
检查给定类型在给定范围内是否可访问。- 参数:
scope- 要检查的范围type- 要检查的类型- 返回:
-
如果
type可访问,则为真
-
isAccessible
检查给定元素是否可以作为给定范围内给定类型的成员访问。- 参数:
scope- 要检查的范围member- 要检查的成员type- 检查成员是否可访问的类型- 返回:
-
如果
member可在type中访问,则为真
-
getOriginalType
从ErrorType对象返回原始类型。- 参数:
errorType- 我们想要获取原始类型的错误类型- 返回:
-
原始类型对应的类型镜像,替换为
ErrorType
-
printMessage
public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root) 在提供的编译单元内的树的位置打印指定类型的消息- 参数:
kind- 消息的种类msg- 消息,如果没有则为空字符串t- 用作位置提示的树root- 包含树的编译单元
-
getLub
返回在 catch 子句中声明的异常参数的 lub。- 参数:
tree- catch 子句的树- 返回:
- 异常参数的 lub
-