R
- the return type of this visitor's methods. Use Void
for visitors that do not need to return results.P
- the type of the additional parameter to this visitor's methods. Use Void
for visitors that do not need an additional parameter.SimpleTreeVisitor
, TreePathScanner
, TreeScanner
public interface TreeVisitor<R,P>
accept
method, the visitXyz
method most applicable to that tree is invoked. Classes implementing this interface may or may not throw a NullPointerException
if the additional parameter p
is null
; see documentation of the implementing class for details.
WARNING: It is possible that methods will be added to this interface to accommodate new, currently unknown, language structures added to future versions of the Java programming language. Therefore, visitor classes directly implementing this interface may be source incompatible with future versions of the platform.
Modifier and Type | Method | Description |
---|---|---|
R |
visitAnnotatedType |
Visits an AnnotatedTypeTree node. |
R |
visitAnnotation |
Visits an AnnotatedTree node. |
R |
visitAnyPattern |
Preview. Visits a AnyPatternTree node. |
R |
visitArrayAccess |
Visits an ArrayAccessTree node. |
R |
visitArrayType |
Visits an ArrayTypeTree node. |
R |
visitAssert |
Visits an AssertTree node. |
R |
visitAssignment |
Visits an AssignmentTree node. |
R |
visitBinary |
Visits a BinaryTree node. |
R |
visitBindingPattern |
Visits a BindingPatternTree node. |
R |
visitBlock |
Visits a BlockTree node. |
R |
visitBreak |
Visits a BreakTree node. |
R |
visitCase |
Visits a CaseTree node. |
R |
visitCatch |
Visits a CatchTree node. |
R |
visitClass |
Visits a ClassTree node. |
R |
visitCompilationUnit |
Visits a CompilationUnitTree node. |
R |
visitCompoundAssignment |
Visits a CompoundAssignmentTree node. |
R |
visitConditionalExpression |
Visits a ConditionalExpressionTree node. |
R |
visitConstantCaseLabel |
Visits a ConstantCaseLabelTree node. |
R |
visitContinue |
Visits a ContinueTree node. |
R |
visitDeconstructionPattern |
Visits a DeconstructionPatternTree node. |
R |
visitDefaultCaseLabel |
Visits a DefaultCaseLabelTree node. |
R |
visitDoWhileLoop |
Visits a DoWhileTree node. |
R |
visitEmptyStatement |
Visits an EmptyStatementTree node. |
R |
visitEnhancedForLoop |
Visits an EnhancedForLoopTree node. |
R |
visitErroneous |
Visits an ErroneousTree node. |
R |
visitExports |
Visits an ExportsTree node. |
R |
visitExpressionStatement |
Visits an ExpressionStatementTree node. |
R |
visitForLoop |
Visits a ForLoopTree node. |
R |
visitIdentifier |
Visits an IdentifierTree node. |
R |
visitIf |
Visits an IfTree node. |
R |
visitImport |
Visits an ImportTree node. |
R |
visitInstanceOf |
Visits an InstanceOfTree node. |
R |
visitIntersectionType |
Visits an IntersectionTypeTree node. |
R |
visitLabeledStatement |
Visits a LabeledStatementTree node. |
R |
visitLambdaExpression |
Visits a LambdaExpressionTree node. |
R |
visitLiteral |
Visits a LiteralTree node. |
R |
visitMemberReference |
Visits a MemberReferenceTree node. |
R |
visitMemberSelect |
Visits a MemberSelectTree node. |
R |
visitMethod |
Visits a MethodTree node. |
R |
visitMethodInvocation |
Visits a MethodInvocationTree node. |
R |
visitModifiers |
Visits a ModifiersTree node. |
R |
visitModule |
Visits a ModuleTree node. |
R |
visitNewArray |
Visits a NewArrayTree node. |
R |
visitNewClass |
Visits a NewClassTree node. |
R |
visitOpens |
Visits an OpensTree node. |
R |
visitOther |
Visits an unknown type of Tree node. |
R |
visitPackage |
Visits a PackageTree node. |
R |
visitParameterizedType |
Visits a ParameterizedTypeTree node. |
R |
visitParenthesized |
Visits a ParenthesizedTree node. |
R |
visitPatternCaseLabel |
Visits a PatternCaseLabelTree node. |
R |
visitPrimitiveType |
Visits a PrimitiveTypeTree node. |
R |
visitProvides |
Visits a ProvidesTree node. |
R |
visitRequires |
Visits a RequiresTree node. |
R |
visitReturn |
Visits a ReturnTree node. |
R |
visitStringTemplate |
Preview. Visits a StringTemplateTree node. |
R |
visitSwitch |
Visits a SwitchTree node. |
R |
visitSwitchExpression |
Visits a SwitchExpressionTree node. |
R |
visitSynchronized |
Visits a SynchronizedTree node. |
R |
visitThrow |
Visits a ThrowTree node. |
R |
visitTry |
Visits a TryTree node. |
R |
visitTypeCast |
Visits a TypeCastTree node. |
R |
visitTypeParameter |
Visits a TypeParameterTree node. |
R |
visitUnary |
Visits a UnaryTree node. |
R |
visitUnionType |
Visits a UnionTypeTree node. |
R |
visitUses |
Visits a UsesTree node. |
R |
visitVariable |
Visits a VariableTree node. |
R |
visitWhileLoop |
Visits a WhileLoopTree node. |
R |
visitWildcard |
Visits a WildcardTypeTree node. |
R |
visitYield |
Visits a YieldTree node. |
R visitAnnotatedType(AnnotatedTypeTree node, P p)
AnnotatedTypeTree
node.node
- the node being visitedp
- a parameter valueR visitAnnotation(AnnotationTree node, P p)
AnnotatedTree
node.node
- the node being visitedp
- a parameter valueR visitMethodInvocation(MethodInvocationTree node, P p)
MethodInvocationTree
node.node
- the node being visitedp
- a parameter valueR visitAssert(AssertTree node, P p)
AssertTree
node.node
- the node being visitedp
- a parameter valueR visitAssignment(AssignmentTree node, P p)
AssignmentTree
node.node
- the node being visitedp
- a parameter valueR visitCompoundAssignment(CompoundAssignmentTree node, P p)
CompoundAssignmentTree
node.node
- the node being visitedp
- a parameter valueR visitBinary(BinaryTree node, P p)
BinaryTree
node.node
- the node being visitedp
- a parameter valueR visitBlock(BlockTree node, P p)
BlockTree
node.node
- the node being visitedp
- a parameter valueR visitBreak(BreakTree node, P p)
BreakTree
node.node
- the node being visitedp
- a parameter valueR visitCase(CaseTree node, P p)
CaseTree
node.node
- the node being visitedp
- a parameter valueR visitCatch(CatchTree node, P p)
CatchTree
node.node
- the node being visitedp
- a parameter valueR visitClass(ClassTree node, P p)
ClassTree
node.node
- the node being visitedp
- a parameter valueR visitConditionalExpression(ConditionalExpressionTree node, P p)
ConditionalExpressionTree
node.node
- the node being visitedp
- a parameter valueR visitContinue(ContinueTree node, P p)
ContinueTree
node.node
- the node being visitedp
- a parameter valueR visitDoWhileLoop(DoWhileLoopTree node, P p)
DoWhileTree
node.node
- the node being visitedp
- a parameter valueR visitErroneous(ErroneousTree node, P p)
ErroneousTree
node.node
- the node being visitedp
- a parameter valueR visitExpressionStatement(ExpressionStatementTree node, P p)
ExpressionStatementTree
node.node
- the node being visitedp
- a parameter valueR visitEnhancedForLoop(EnhancedForLoopTree node, P p)
EnhancedForLoopTree
node.node
- the node being visitedp
- a parameter valueR visitForLoop(ForLoopTree node, P p)
ForLoopTree
node.node
- the node being visitedp
- a parameter valueR visitIdentifier(IdentifierTree node, P p)
IdentifierTree
node.node
- the node being visitedp
- a parameter valueR visitIf(IfTree node, P p)
IfTree
node.node
- the node being visitedp
- a parameter valueR visitImport(ImportTree node, P p)
ImportTree
node.node
- the node being visitedp
- a parameter valueR visitArrayAccess(ArrayAccessTree node, P p)
ArrayAccessTree
node.node
- the node being visitedp
- a parameter valueR visitLabeledStatement(LabeledStatementTree node, P p)
LabeledStatementTree
node.node
- the node being visitedp
- a parameter valueR visitLiteral(LiteralTree node, P p)
LiteralTree
node.node
- the node being visitedp
- a parameter valueR visitStringTemplate(StringTemplateTreePREVIEW node, P p)
visitStringTemplate
is a reflective preview API of the Java platform. node
- the node being visitedp
- a parameter valueR visitAnyPattern(AnyPatternTreePREVIEW node, P p)
visitAnyPattern
is a preview API of the Java platform. visitAnyPattern
when preview features are enabled.AnyPatternTree
node.node
- the node being visitedp
- a parameter valueR visitBindingPattern(BindingPatternTree node, P p)
BindingPatternTree
node.node
- the node being visitedp
- a parameter valueR visitDefaultCaseLabel(DefaultCaseLabelTree node, P p)
DefaultCaseLabelTree
node.node
- the node being visitedp
- a parameter valueR visitConstantCaseLabel(ConstantCaseLabelTree node, P p)
ConstantCaseLabelTree
node.node
- the node being visitedp
- a parameter valueR visitPatternCaseLabel(PatternCaseLabelTree node, P p)
PatternCaseLabelTree
node.node
- the node being visitedp
- a parameter valueR visitDeconstructionPattern(DeconstructionPatternTree node, P p)
DeconstructionPatternTree
node.node
- the node being visitedp
- a parameter valueR visitMethod(MethodTree node, P p)
MethodTree
node.node
- the node being visitedp
- a parameter valueR visitModifiers(ModifiersTree node, P p)
ModifiersTree
node.node
- the node being visitedp
- a parameter valueR visitNewArray(NewArrayTree node, P p)
NewArrayTree
node.node
- the node being visitedp
- a parameter valueR visitNewClass(NewClassTree node, P p)
NewClassTree
node.node
- the node being visitedp
- a parameter valueR visitLambdaExpression(LambdaExpressionTree node, P p)
LambdaExpressionTree
node.node
- the node being visitedp
- a parameter valueR visitPackage(PackageTree node, P p)
PackageTree
node.node
- the node being visitedp
- a parameter valueR visitParenthesized(ParenthesizedTree node, P p)
ParenthesizedTree
node.node
- the node being visitedp
- a parameter valueR visitReturn(ReturnTree node, P p)
ReturnTree
node.node
- the node being visitedp
- a parameter valueR visitMemberSelect(MemberSelectTree node, P p)
MemberSelectTree
node.node
- the node being visitedp
- a parameter valueR visitMemberReference(MemberReferenceTree node, P p)
MemberReferenceTree
node.node
- the node being visitedp
- a parameter valueR visitEmptyStatement(EmptyStatementTree node, P p)
EmptyStatementTree
node.node
- the node being visitedp
- a parameter valueR visitSwitch(SwitchTree node, P p)
SwitchTree
node.node
- the node being visitedp
- a parameter valueR visitSwitchExpression(SwitchExpressionTree node, P p)
SwitchExpressionTree
node.node
- the node being visitedp
- a parameter valueR visitSynchronized(SynchronizedTree node, P p)
SynchronizedTree
node.node
- the node being visitedp
- a parameter valueR visitThrow(ThrowTree node, P p)
ThrowTree
node.node
- the node being visitedp
- a parameter valueR visitCompilationUnit(CompilationUnitTree node, P p)
CompilationUnitTree
node.node
- the node being visitedp
- a parameter valueR visitTry(TryTree node, P p)
TryTree
node.node
- the node being visitedp
- a parameter valueR visitParameterizedType(ParameterizedTypeTree node, P p)
ParameterizedTypeTree
node.node
- the node being visitedp
- a parameter valueR visitUnionType(UnionTypeTree node, P p)
UnionTypeTree
node.node
- the node being visitedp
- a parameter valueR visitIntersectionType(IntersectionTypeTree node, P p)
IntersectionTypeTree
node.node
- the node being visitedp
- a parameter valueR visitArrayType(ArrayTypeTree node, P p)
ArrayTypeTree
node.node
- the node being visitedp
- a parameter valueR visitTypeCast(TypeCastTree node, P p)
TypeCastTree
node.node
- the node being visitedp
- a parameter valueR visitPrimitiveType(PrimitiveTypeTree node, P p)
PrimitiveTypeTree
node.node
- the node being visitedp
- a parameter valueR visitTypeParameter(TypeParameterTree node, P p)
TypeParameterTree
node.node
- the node being visitedp
- a parameter valueR visitInstanceOf(InstanceOfTree node, P p)
InstanceOfTree
node.node
- the node being visitedp
- a parameter valueR visitUnary(UnaryTree node, P p)
UnaryTree
node.node
- the node being visitedp
- a parameter valueR visitVariable(VariableTree node, P p)
VariableTree
node.node
- the node being visitedp
- a parameter valueR visitWhileLoop(WhileLoopTree node, P p)
WhileLoopTree
node.node
- the node being visitedp
- a parameter valueR visitWildcard(WildcardTree node, P p)
WildcardTypeTree
node.node
- the node being visitedp
- a parameter valueR visitModule(ModuleTree node, P p)
ModuleTree
node.node
- the node being visitedp
- a parameter valueR visitExports(ExportsTree node, P p)
ExportsTree
node.node
- the node being visitedp
- a parameter valueR visitOpens(OpensTree node, P p)
OpensTree
node.node
- the node being visitedp
- a parameter valueR visitProvides(ProvidesTree node, P p)
ProvidesTree
node.node
- the node being visitedp
- a parameter valueR visitRequires(RequiresTree node, P p)
RequiresTree
node.node
- the node being visitedp
- a parameter valueR visitUses(UsesTree node, P p)
UsesTree
node.node
- the node being visitedp
- a parameter valueR visitOther(Tree node, P p)
Tree
node. This can occur if the language evolves and new kinds of nodes are added to the Tree
hierarchy.node
- the node being visitedp
- a parameter valueR visitYield(YieldTree node, P p)
YieldTree
node.node
- the node being visitedp
- a parameter value
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/tree/TreeVisitor.html