- Type Parameters:
R
- the return type of this visitor's methods. UseVoid
for visitors that do not need to return results.P
- the type of the additional parameter to this visitor's methods. UseVoid
for visitors that do not need an additional parameter.
- All Known Implementing Classes:
SimpleTreeVisitor
,TreePathScanner
,TreeScanner
public interface TreeVisitor<R,P>
A visitor of trees, in the style of the visitor design pattern.
Classes implementing this interface are used to operate
on a tree when the kind of tree is unknown at compile time.
When a visitor is passed to an tree's
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.
- Since:
- 1.6
-
Method Summary
Modifier and Type Method Description R
visitAnnotatedType(AnnotatedTypeTree node, P p)
Visits an AnnotatedTypeTree node.R
visitAnnotation(AnnotationTree node, P p)
Visits an AnnotatedTree node.R
visitArrayAccess(ArrayAccessTree node, P p)
Visits an ArrayAccessTree node.R
visitArrayType(ArrayTypeTree node, P p)
Visits an ArrayTypeTree node.R
visitAssert(AssertTree node, P p)
Visits an AssertTree node.R
visitAssignment(AssignmentTree node, P p)
Visits an AssignmentTree node.R
visitBinary(BinaryTree node, P p)
Visits a BinaryTree node.R
visitBindingPattern(BindingPatternTree node, P p)
Associated with pattern matching for instanceof, a preview feature of the Java language.
Visits an BindingPattern node.R
visitBlock(BlockTree node, P p)
Visits a BlockTree node.R
visitBreak(BreakTree node, P p)
Visits a BreakTree node.R
visitCase(CaseTree node, P p)
Visits a CaseTree node.R
visitCatch(CatchTree node, P p)
Visits a CatchTree node.R
visitClass(ClassTree node, P p)
Visits a ClassTree node.R
visitCompilationUnit(CompilationUnitTree node, P p)
Visits a CompilationUnitTree node.R
visitCompoundAssignment(CompoundAssignmentTree node, P p)
Visits a CompoundAssignmentTree node.R
visitConditionalExpression(ConditionalExpressionTree node, P p)
Visits a ConditionalExpressionTree node.R
visitContinue(ContinueTree node, P p)
Visits a ContinueTree node.R
visitDoWhileLoop(DoWhileLoopTree node, P p)
Visits a DoWhileTree node.R
visitEmptyStatement(EmptyStatementTree node, P p)
Visits an EmptyStatementTree node.R
visitEnhancedForLoop(EnhancedForLoopTree node, P p)
Visits an EnhancedForLoopTree node.R
visitErroneous(ErroneousTree node, P p)
Visits an ErroneousTree node.R
visitExports(ExportsTree node, P p)
Visits an ExportsTree node.R
visitExpressionStatement(ExpressionStatementTree node, P p)
Visits an ExpressionStatementTree node.R
visitForLoop(ForLoopTree node, P p)
Visits a ForLoopTree node.R
visitIdentifier(IdentifierTree node, P p)
Visits an IdentifierTree node.R
visitIf(IfTree node, P p)
Visits an IfTree node.R
visitImport(ImportTree node, P p)
Visits an ImportTree node.R
visitInstanceOf(InstanceOfTree node, P p)
Visits an InstanceOfTree node.R
visitIntersectionType(IntersectionTypeTree node, P p)
Visits an IntersectionTypeTree node.R
visitLabeledStatement(LabeledStatementTree node, P p)
Visits a LabeledStatementTree node.R
visitLambdaExpression(LambdaExpressionTree node, P p)
Visits a LambdaExpressionTree node.R
visitLiteral(LiteralTree node, P p)
Visits a LiteralTree node.R
visitMemberReference(MemberReferenceTree node, P p)
Visits a MemberReferenceTree node.R
visitMemberSelect(MemberSelectTree node, P p)
Visits a MemberSelectTree node.R
visitMethod(MethodTree node, P p)
Visits a MethodTree node.R
visitMethodInvocation(MethodInvocationTree node, P p)
Visits a MethodInvocationTree node.R
visitModifiers(ModifiersTree node, P p)
Visits a ModifiersTree node.R
visitModule(ModuleTree node, P p)
Visits a ModuleTree node.R
visitNewArray(NewArrayTree node, P p)
Visits a NewArrayTree node.R
visitNewClass(NewClassTree node, P p)
Visits a NewClassTree node.R
visitOpens(OpensTree node, P p)
Visits an OpensTree node.R
visitOther(Tree node, P p)
Visits an unknown type of Tree node.R
visitPackage(PackageTree node, P p)
Visits a PackageTree node.R
visitParameterizedType(ParameterizedTypeTree node, P p)
Visits a ParameterizedTypeTree node.R
visitParenthesized(ParenthesizedTree node, P p)
Visits a ParenthesizedTree node.R
visitPrimitiveType(PrimitiveTypeTree node, P p)
Visits a PrimitiveTypeTree node.R
visitProvides(ProvidesTree node, P p)
Visits a ProvidesTree node.R
visitRequires(RequiresTree node, P p)
Visits a RequiresTree node.R
visitReturn(ReturnTree node, P p)
Visits a ReturnTree node.R
visitSwitch(SwitchTree node, P p)
Visits a SwitchTree node.R
visitSwitchExpression(SwitchExpressionTree node, P p)
Visits a SwitchExpressionTree node.R
visitSynchronized(SynchronizedTree node, P p)
Visits a SynchronizedTree node.R
visitThrow(ThrowTree node, P p)
Visits a ThrowTree node.R
visitTry(TryTree node, P p)
Visits a TryTree node.R
visitTypeCast(TypeCastTree node, P p)
Visits a TypeCastTree node.R
visitTypeParameter(TypeParameterTree node, P p)
Visits a TypeParameterTree node.R
visitUnary(UnaryTree node, P p)
Visits a UnaryTree node.R
visitUnionType(UnionTypeTree node, P p)
Visits a UnionTypeTree node.R
visitUses(UsesTree node, P p)
Visits a UsesTree node.R
visitVariable(VariableTree node, P p)
Visits a VariableTree node.R
visitWhileLoop(WhileLoopTree node, P p)
Visits a WhileLoopTree node.R
visitWildcard(WildcardTree node, P p)
Visits a WildcardTypeTree node.R
visitYield(YieldTree node, P p)
Visits a YieldTree node.
-
Method Details
-
visitAnnotatedType
Visits an AnnotatedTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAnnotation
Visits an AnnotatedTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMethodInvocation
Visits a MethodInvocationTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAssert
Visits an AssertTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAssignment
Visits an AssignmentTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitCompoundAssignment
Visits a CompoundAssignmentTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBinary
Visits a BinaryTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBlock
Visits a BlockTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBreak
Visits a BreakTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitCase
Visits a CaseTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitCatch
Visits a CatchTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitClass
Visits a ClassTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitConditionalExpression
Visits a ConditionalExpressionTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitContinue
Visits a ContinueTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitDoWhileLoop
Visits a DoWhileTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitErroneous
Visits an ErroneousTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitExpressionStatement
Visits an ExpressionStatementTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitEnhancedForLoop
Visits an EnhancedForLoopTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitForLoop
Visits a ForLoopTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIdentifier
Visits an IdentifierTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIf
Visits an IfTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitImport
Visits an ImportTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitArrayAccess
Visits an ArrayAccessTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLabeledStatement
Visits a LabeledStatementTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLiteral
Visits a LiteralTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBindingPattern
This method is associated with pattern matching for instanceof, a preview feature of the Java language. Preview features may be removed in a future release, or upgraded to permanent features of the Java language.
Visits an BindingPattern node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 14
-
visitMethod
Visits a MethodTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitModifiers
Visits a ModifiersTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitNewArray
Visits a NewArrayTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitNewClass
Visits a NewClassTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLambdaExpression
Visits a LambdaExpressionTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitPackage
Visits a PackageTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitParenthesized
Visits a ParenthesizedTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitReturn
Visits a ReturnTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMemberSelect
Visits a MemberSelectTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMemberReference
Visits a MemberReferenceTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitEmptyStatement
Visits an EmptyStatementTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitSwitch
Visits a SwitchTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitSwitchExpression
Visits a SwitchExpressionTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 12
-
visitSynchronized
Visits a SynchronizedTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitThrow
Visits a ThrowTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitCompilationUnit
Visits a CompilationUnitTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTry
Visits a TryTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitParameterizedType
Visits a ParameterizedTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUnionType
Visits a UnionTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIntersectionType
Visits an IntersectionTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitArrayType
Visits an ArrayTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTypeCast
Visits a TypeCastTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitPrimitiveType
Visits a PrimitiveTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTypeParameter
Visits a TypeParameterTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitInstanceOf
Visits an InstanceOfTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUnary
Visits a UnaryTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitVariable
Visits a VariableTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitWhileLoop
Visits a WhileLoopTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitWildcard
Visits a WildcardTypeTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitModule
Visits a ModuleTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitExports
Visits an ExportsTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitOpens
Visits an OpensTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitProvides
Visits a ProvidesTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitRequires
Visits a RequiresTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUses
Visits a UsesTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitOther
Visits an unknown type of Tree node. This can occur if the language evolves and new kinds of nodes are added to theTree
hierarchy.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitYield
Visits a YieldTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 13
-