- 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 a 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 TypeMethodDescriptionvisitAnnotatedType
(AnnotatedTypeTree node, P p) Visits anAnnotatedTypeTree
node.visitAnnotation
(AnnotationTree node, P p) Visits anAnnotatedTree
node.visitAnyPattern
(AnyPatternTree node, P p) Visits aAnyPatternTree
node.visitArrayAccess
(ArrayAccessTree node, P p) Visits anArrayAccessTree
node.visitArrayType
(ArrayTypeTree node, P p) Visits anArrayTypeTree
node.visitAssert
(AssertTree node, P p) Visits anAssertTree
node.visitAssignment
(AssignmentTree node, P p) Visits anAssignmentTree
node.visitBinary
(BinaryTree node, P p) Visits aBinaryTree
node.visitBindingPattern
(BindingPatternTree node, P p) Visits aBindingPatternTree
node.visitBlock
(BlockTree node, P p) Visits aBlockTree
node.visitBreak
(BreakTree node, P p) Visits aBreakTree
node.Visits aCaseTree
node.visitCatch
(CatchTree node, P p) Visits aCatchTree
node.visitClass
(ClassTree node, P p) Visits aClassTree
node.visitCompilationUnit
(CompilationUnitTree node, P p) Visits aCompilationUnitTree
node.Visits aCompoundAssignmentTree
node.Visits aConditionalExpressionTree
node.visitConstantCaseLabel
(ConstantCaseLabelTree node, P p) Visits aConstantCaseLabelTree
node.visitContinue
(ContinueTree node, P p) Visits aContinueTree
node.Visits aDeconstructionPatternTree
node.visitDefaultCaseLabel
(DefaultCaseLabelTree node, P p) Visits aDefaultCaseLabelTree
node.visitDoWhileLoop
(DoWhileLoopTree node, P p) Visits aDoWhileTree
node.visitEmptyStatement
(EmptyStatementTree node, P p) Visits anEmptyStatementTree
node.visitEnhancedForLoop
(EnhancedForLoopTree node, P p) Visits anEnhancedForLoopTree
node.visitErroneous
(ErroneousTree node, P p) Visits anErroneousTree
node.visitExports
(ExportsTree node, P p) Visits anExportsTree
node.Visits anExpressionStatementTree
node.visitForLoop
(ForLoopTree node, P p) Visits aForLoopTree
node.visitIdentifier
(IdentifierTree node, P p) Visits anIdentifierTree
node.Visits anIfTree
node.visitImport
(ImportTree node, P p) Visits anImportTree
node.visitInstanceOf
(InstanceOfTree node, P p) Visits anInstanceOfTree
node.visitIntersectionType
(IntersectionTypeTree node, P p) Visits anIntersectionTypeTree
node.visitLabeledStatement
(LabeledStatementTree node, P p) Visits aLabeledStatementTree
node.visitLambdaExpression
(LambdaExpressionTree node, P p) Visits aLambdaExpressionTree
node.visitLiteral
(LiteralTree node, P p) Visits aLiteralTree
node.visitMemberReference
(MemberReferenceTree node, P p) Visits aMemberReferenceTree
node.visitMemberSelect
(MemberSelectTree node, P p) Visits aMemberSelectTree
node.visitMethod
(MethodTree node, P p) Visits aMethodTree
node.visitMethodInvocation
(MethodInvocationTree node, P p) Visits aMethodInvocationTree
node.visitModifiers
(ModifiersTree node, P p) Visits aModifiersTree
node.visitModule
(ModuleTree node, P p) Visits aModuleTree
node.visitNewArray
(NewArrayTree node, P p) Visits aNewArrayTree
node.visitNewClass
(NewClassTree node, P p) Visits aNewClassTree
node.visitOpens
(OpensTree node, P p) Visits anOpensTree
node.visitOther
(Tree node, P p) Visits an unknown type ofTree
node.visitPackage
(PackageTree node, P p) Visits aPackageTree
node.visitParameterizedType
(ParameterizedTypeTree node, P p) Visits aParameterizedTypeTree
node.visitParenthesized
(ParenthesizedTree node, P p) Visits aParenthesizedTree
node.visitPatternCaseLabel
(PatternCaseLabelTree node, P p) Visits aPatternCaseLabelTree
node.visitPrimitiveType
(PrimitiveTypeTree node, P p) Visits aPrimitiveTypeTree
node.visitProvides
(ProvidesTree node, P p) Visits aProvidesTree
node.visitRequires
(RequiresTree node, P p) Visits aRequiresTree
node.visitReturn
(ReturnTree node, P p) Visits aReturnTree
node.Preview.Visits a StringTemplateTree node.visitSwitch
(SwitchTree node, P p) Visits aSwitchTree
node.visitSwitchExpression
(SwitchExpressionTree node, P p) Visits aSwitchExpressionTree
node.visitSynchronized
(SynchronizedTree node, P p) Visits aSynchronizedTree
node.visitThrow
(ThrowTree node, P p) Visits aThrowTree
node.Visits aTryTree
node.visitTypeCast
(TypeCastTree node, P p) Visits aTypeCastTree
node.visitTypeParameter
(TypeParameterTree node, P p) Visits aTypeParameterTree
node.visitUnary
(UnaryTree node, P p) Visits aUnaryTree
node.visitUnionType
(UnionTypeTree node, P p) Visits aUnionTypeTree
node.Visits aUsesTree
node.visitVariable
(VariableTree node, P p) Visits aVariableTree
node.visitWhileLoop
(WhileLoopTree node, P p) Visits aWhileLoopTree
node.visitWildcard
(WildcardTree node, P p) Visits aWildcardTypeTree
node.visitYield
(YieldTree node, P p) Visits aYieldTree
node.
-
Method Details
-
visitAnnotatedType
Visits anAnnotatedTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAnnotation
Visits anAnnotatedTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMethodInvocation
Visits aMethodInvocationTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAssert
Visits anAssertTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitAssignment
Visits anAssignmentTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitCompoundAssignment
Visits aCompoundAssignmentTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBinary
Visits aBinaryTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitBlock
-
visitBreak
-
visitCase
-
visitCatch
-
visitClass
-
visitConditionalExpression
Visits aConditionalExpressionTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitContinue
Visits aContinueTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitDoWhileLoop
Visits aDoWhileTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitErroneous
Visits anErroneousTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitExpressionStatement
Visits anExpressionStatementTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitEnhancedForLoop
Visits anEnhancedForLoopTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitForLoop
Visits aForLoopTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIdentifier
Visits anIdentifierTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIf
-
visitImport
Visits anImportTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitArrayAccess
Visits anArrayAccessTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLabeledStatement
Visits aLabeledStatementTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLiteral
Visits aLiteralTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitStringTemplate
visitStringTemplate
is a reflective preview API of the Java platform.Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.Visits a StringTemplateTree node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 21
-
visitAnyPattern
Visits aAnyPatternTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 22
-
visitBindingPattern
Visits aBindingPatternTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 16
-
visitDefaultCaseLabel
Visits aDefaultCaseLabelTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 21
-
visitConstantCaseLabel
Visits aConstantCaseLabelTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 21
-
visitPatternCaseLabel
Visits aPatternCaseLabelTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 21
-
visitDeconstructionPattern
Visits aDeconstructionPatternTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 21
-
visitMethod
Visits aMethodTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitModifiers
Visits aModifiersTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitNewArray
Visits aNewArrayTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitNewClass
Visits aNewClassTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitLambdaExpression
Visits aLambdaExpressionTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitPackage
Visits aPackageTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitParenthesized
Visits aParenthesizedTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitReturn
Visits aReturnTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMemberSelect
Visits aMemberSelectTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitMemberReference
Visits aMemberReferenceTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitEmptyStatement
Visits anEmptyStatementTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitSwitch
Visits aSwitchTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitSwitchExpression
Visits aSwitchExpressionTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
- Since:
- 12
-
visitSynchronized
Visits aSynchronizedTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitThrow
-
visitCompilationUnit
Visits aCompilationUnitTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTry
-
visitParameterizedType
Visits aParameterizedTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUnionType
Visits aUnionTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitIntersectionType
Visits anIntersectionTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitArrayType
Visits anArrayTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTypeCast
Visits aTypeCastTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitPrimitiveType
Visits aPrimitiveTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitTypeParameter
Visits aTypeParameterTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitInstanceOf
Visits anInstanceOfTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUnary
-
visitVariable
Visits aVariableTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitWhileLoop
Visits aWhileLoopTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitWildcard
Visits aWildcardTypeTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitModule
Visits aModuleTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitExports
Visits anExportsTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitOpens
-
visitProvides
Visits aProvidesTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitRequires
Visits aRequiresTree
node.- Parameters:
node
- the node being visitedp
- a parameter value- Returns:
- a result value
-
visitUses
-
visitOther
-
visitYield
-