Tree (Compiler Tree API )
Keywords: com.sun.source.tree.Tree interface
Date: 2016-12-09

com.sun.source.tree

## Interface Tree

- All Known Subinterfaces:
    AnnotatedTypeTree, AnnotationTree, ArrayAccessTree, ArrayTypeTree, AssertTree, AssignmentTree, BinaryTree, BlockTree, BreakTree, CaseTree, CatchTree, ClassTree, CompilationUnitTree, CompoundAssignmentTree, ConditionalExpressionTree, ContinueTree, DoWhileLoopTree, EmptyStatementTree, EnhancedForLoopTree, ErroneousTree, ExpressionStatementTree, ExpressionTree, ForLoopTree, IdentifierTree, IfTree, ImportTree, InstanceOfTree, IntersectionTypeTree, LabeledStatementTree, LambdaExpressionTree, LiteralTree, MemberReferenceTree, MemberSelectTree, MethodInvocationTree, MethodTree, ModifiersTree, NewArrayTree, NewClassTree, ParameterizedTypeTree, ParenthesizedTree, PrimitiveTypeTree, ReturnTree, StatementTree, SwitchTree, SynchronizedTree, ThrowTree, TryTree, TypeCastTree, TypeParameterTree, UnaryTree, UnionTypeTree, VariableTree, WhileLoopTree, WildcardTree

      @Exported
      public interface Tree

  Common interface for all nodes in an abstract syntax tree.

  WARNING: This interface and its sub-interfaces are subject to change as the Java™ programming language evolves. These interfaces are implemented by the JDK Java compiler (javac) and should not be implemented either directly or indirectly by other applications.

  Since:
    1.6

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `Tree.Kind` Enumerates all kinds of trees.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<R,D> R` | `accept(TreeVisitor<R,D> visitor, D data)` Accept method used to implement the visitor pattern.
    `Tree.Kind` | `getKind()` Gets the kind of this tree.

- - ### Method Detail

    - #### getKind

          Tree.Kind getKind()

      Gets the kind of this tree.
      Returns:
        the kind of this tree.

    - #### accept

          <R,D> R accept(TreeVisitor<R,D> visitor,
                         D data)

      Accept method used to implement the visitor pattern. The visitor pattern is used to implement operations on trees.
      Type Parameters:
        `R` - result type of this operation.
        `D` - type of additional data.

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