- 所有已知的子接口:
-
AnnotatedTypeTree
,AnnotationTree
,AnyPatternTree预览
,ArrayAccessTree
,ArrayTypeTree
,AssertTree
,AssignmentTree
,BinaryTree
,BindingPatternTree
,BlockTree
,BreakTree
,CaseLabelTree
,CaseTree
,CatchTree
,ClassTree
,CompilationUnitTree
,CompoundAssignmentTree
,ConditionalExpressionTree
,ConstantCaseLabelTree
,ContinueTree
,DeconstructionPatternTree
,DefaultCaseLabelTree
,DirectiveTree
,DoWhileLoopTree
,EmptyStatementTree
,EnhancedForLoopTree
,ErroneousTree
,ExportsTree
,ExpressionStatementTree
,ExpressionTree
,ForLoopTree
,IdentifierTree
,IfTree
,ImportTree
,InstanceOfTree
,IntersectionTypeTree
,LabeledStatementTree
,LambdaExpressionTree
,LiteralTree
,MemberReferenceTree
,MemberSelectTree
,MethodInvocationTree
,MethodTree
,ModifiersTree
,ModuleTree
,NewArrayTree
,NewClassTree
,OpensTree
,PackageTree
,ParameterizedTypeTree
,ParenthesizedTree
,PatternCaseLabelTree
,PatternTree
,PrimitiveTypeTree
,ProvidesTree
,RequiresTree
,ReturnTree
,StatementTree
,StringTemplateTree预览
,SwitchExpressionTree
,SwitchTree
,SynchronizedTree
,ThrowTree
,TryTree
,TypeCastTree
,TypeParameterTree
,UnaryTree
,UnionTypeTree
,UsesTree
,VariableTree
,WhileLoopTree
,WildcardTree
,YieldTree
public interface Tree
所有抽象语法树中节点的通用接口。
警告: 此接口及其子接口可能会随着Java编程语言的发展而发生变化。这些接口由JDK Java编译器(javac)实现,不应该由其他应用程序直接或间接实现。
- 自Java版本:
- 1.6
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescription<R,
D> R accept
(TreeVisitor<R, D> visitor, D data) 用于实现访问者模式的接受方法。getKind()
返回此树的种类。
-
Method Details
-
getKind
Tree.Kind getKind()返回此树的种类。- 返回:
- 此树的种类
-
accept
用于实现访问者模式的接受方法。访问者模式用于在树上实现操作。- 类型参数:
-
R
- 此操作的结果类型 -
D
- 附加数据的类型 - 参数:
-
visitor
- 要调用的访问者 -
data
- 要传递给访问者的值 - 返回:
- 调用访问者后返回的结果
-