TreeVisitor (Compiler Tree API )
Keywords: com.sun.source.tree.TreeVisitor interface
Date: 2015-11-18

com.sun.source.tree

## Interface TreeVisitor<R,P>

- Type Parameters:
    `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.
  All Known Implementing Classes:
    SimpleTreeVisitor, TreePathScanner, TreeScanner

      @Exported
      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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `visitAnnotatedType(AnnotatedTypeTree node, P p)`
    `R` | `visitAnnotation(AnnotationTree node, P p)`
    `R` | `visitArrayAccess(ArrayAccessTree node, P p)`
    `R` | `visitArrayType(ArrayTypeTree node, P p)`
    `R` | `visitAssert(AssertTree node, P p)`
    `R` | `visitAssignment(AssignmentTree node, P p)`
    `R` | `visitBinary(BinaryTree node, P p)`
    `R` | `visitBlock(BlockTree node, P p)`
    `R` | `visitBreak(BreakTree node, P p)`
    `R` | `visitCase(CaseTree node, P p)`
    `R` | `visitCatch(CatchTree node, P p)`
    `R` | `visitClass(ClassTree node, P p)`
    `R` | `visitCompilationUnit(CompilationUnitTree node, P p)`
    `R` | `visitCompoundAssignment(CompoundAssignmentTree node, P p)`
    `R` | `visitConditionalExpression(ConditionalExpressionTree node, P p)`
    `R` | `visitContinue(ContinueTree node, P p)`
    `R` | `visitDoWhileLoop(DoWhileLoopTree node, P p)`
    `R` | `visitEmptyStatement(EmptyStatementTree node, P p)`
    `R` | `visitEnhancedForLoop(EnhancedForLoopTree node, P p)`
    `R` | `visitErroneous(ErroneousTree node, P p)`
    `R` | `visitExpressionStatement(ExpressionStatementTree node, P p)`
    `R` | `visitForLoop(ForLoopTree node, P p)`
    `R` | `visitIdentifier(IdentifierTree node, P p)`
    `R` | `visitIf(IfTree node, P p)`
    `R` | `visitImport(ImportTree node, P p)`
    `R` | `visitInstanceOf(InstanceOfTree node, P p)`
    `R` | `visitIntersectionType(IntersectionTypeTree node, P p)`
    `R` | `visitLabeledStatement(LabeledStatementTree node, P p)`
    `R` | `visitLambdaExpression(LambdaExpressionTree node, P p)`
    `R` | `visitLiteral(LiteralTree node, P p)`
    `R` | `visitMemberReference(MemberReferenceTree node, P p)`
    `R` | `visitMemberSelect(MemberSelectTree node, P p)`
    `R` | `visitMethod(MethodTree node, P p)`
    `R` | `visitMethodInvocation(MethodInvocationTree node, P p)`
    `R` | `visitModifiers(ModifiersTree node, P p)`
    `R` | `visitNewArray(NewArrayTree node, P p)`
    `R` | `visitNewClass(NewClassTree node, P p)`
    `R` | `visitOther(Tree node, P p)`
    `R` | `visitParameterizedType(ParameterizedTypeTree node, P p)`
    `R` | `visitParenthesized(ParenthesizedTree node, P p)`
    `R` | `visitPrimitiveType(PrimitiveTypeTree node, P p)`
    `R` | `visitReturn(ReturnTree node, P p)`
    `R` | `visitSwitch(SwitchTree node, P p)`
    `R` | `visitSynchronized(SynchronizedTree node, P p)`
    `R` | `visitThrow(ThrowTree node, P p)`
    `R` | `visitTry(TryTree node, P p)`
    `R` | `visitTypeCast(TypeCastTree node, P p)`
    `R` | `visitTypeParameter(TypeParameterTree node, P p)`
    `R` | `visitUnary(UnaryTree node, P p)`
    `R` | `visitUnionType(UnionTypeTree node, P p)`
    `R` | `visitVariable(VariableTree node, P p)`
    `R` | `visitWhileLoop(WhileLoopTree node, P p)`
    `R` | `visitWildcard(WildcardTree node, P p)`

- - ### Method Detail

    - #### visitAnnotatedType

          R visitAnnotatedType(AnnotatedTypeTree node,
                               P p)

    - #### visitAnnotation

          R visitAnnotation(AnnotationTree node,
                            P p)

    - #### visitMethodInvocation

          R visitMethodInvocation(MethodInvocationTree node,
                                  P p)

    - #### visitAssert

          R visitAssert(AssertTree node,
                        P p)

    - #### visitAssignment

          R visitAssignment(AssignmentTree node,
                            P p)

    - #### visitCompoundAssignment

          R visitCompoundAssignment(CompoundAssignmentTree node,
                                    P p)

    - #### visitBinary

          R visitBinary(BinaryTree node,
                        P p)

    - #### visitBlock

          R visitBlock(BlockTree node,
                       P p)

    - #### visitBreak

          R visitBreak(BreakTree node,
                       P p)

    - #### visitCase

          R visitCase(CaseTree node,
                      P p)

    - #### visitCatch

          R visitCatch(CatchTree node,
                       P p)

    - #### visitClass

          R visitClass(ClassTree node,
                       P p)

    - #### visitConditionalExpression

          R visitConditionalExpression(ConditionalExpressionTree node,
                                       P p)

    - #### visitContinue

          R visitContinue(ContinueTree node,
                          P p)

    - #### visitDoWhileLoop

          R visitDoWhileLoop(DoWhileLoopTree node,
                             P p)

    - #### visitErroneous

          R visitErroneous(ErroneousTree node,
                           P p)

    - #### visitExpressionStatement

          R visitExpressionStatement(ExpressionStatementTree node,
                                     P p)

    - #### visitEnhancedForLoop

          R visitEnhancedForLoop(EnhancedForLoopTree node,
                                 P p)

    - #### visitForLoop

          R visitForLoop(ForLoopTree node,
                         P p)

    - #### visitIdentifier

          R visitIdentifier(IdentifierTree node,
                            P p)

    - #### visitIf

          R visitIf(IfTree node,
                    P p)

    - #### visitImport

          R visitImport(ImportTree node,
                        P p)

    - #### visitArrayAccess

          R visitArrayAccess(ArrayAccessTree node,
                             P p)

    - #### visitLabeledStatement

          R visitLabeledStatement(LabeledStatementTree node,
                                  P p)

    - #### visitLiteral

          R visitLiteral(LiteralTree node,
                         P p)

    - #### visitMethod

          R visitMethod(MethodTree node,
                        P p)

    - #### visitModifiers

          R visitModifiers(ModifiersTree node,
                           P p)

    - #### visitNewArray

          R visitNewArray(NewArrayTree node,
                          P p)

    - #### visitNewClass

          R visitNewClass(NewClassTree node,
                          P p)

    - #### visitLambdaExpression

          R visitLambdaExpression(LambdaExpressionTree node,
                                  P p)

    - #### visitParenthesized

          R visitParenthesized(ParenthesizedTree node,
                               P p)

    - #### visitReturn

          R visitReturn(ReturnTree node,
                        P p)

    - #### visitMemberSelect

          R visitMemberSelect(MemberSelectTree node,
                              P p)

    - #### visitMemberReference

          R visitMemberReference(MemberReferenceTree node,
                                 P p)

    - #### visitEmptyStatement

          R visitEmptyStatement(EmptyStatementTree node,
                                P p)

    - #### visitSwitch

          R visitSwitch(SwitchTree node,
                        P p)

    - #### visitSynchronized

          R visitSynchronized(SynchronizedTree node,
                              P p)

    - #### visitThrow

          R visitThrow(ThrowTree node,
                       P p)

    - #### visitCompilationUnit

          R visitCompilationUnit(CompilationUnitTree node,
                                 P p)

    - #### visitTry

          R visitTry(TryTree node,
                     P p)

    - #### visitParameterizedType

          R visitParameterizedType(ParameterizedTypeTree node,
                                   P p)

    - #### visitUnionType

          R visitUnionType(UnionTypeTree node,
                           P p)

    - #### visitIntersectionType

          R visitIntersectionType(IntersectionTypeTree node,
                                  P p)

    - #### visitArrayType

          R visitArrayType(ArrayTypeTree node,
                           P p)

    - #### visitTypeCast

          R visitTypeCast(TypeCastTree node,
                          P p)

    - #### visitPrimitiveType

          R visitPrimitiveType(PrimitiveTypeTree node,
                               P p)

    - #### visitTypeParameter

          R visitTypeParameter(TypeParameterTree node,
                               P p)

    - #### visitInstanceOf

          R visitInstanceOf(InstanceOfTree node,
                            P p)

    - #### visitUnary

          R visitUnary(UnaryTree node,
                       P p)

    - #### visitVariable

          R visitVariable(VariableTree node,
                          P p)

    - #### visitWhileLoop

          R visitWhileLoop(WhileLoopTree node,
                           P p)

    - #### visitWildcard

          R visitWildcard(WildcardTree node,
                          P p)

    - #### visitOther

          R visitOther(Tree node,
                       P p)

Copyright © 2005, 2015, Oracle and/or its affiliates. All rights reserved.