DocTree (Compiler Tree API )
Keywords: com.sun.source.doctree.DocTree interface
Date: 2026-01-21

com.sun.source.doctree

## Interface DocTree

- All Known Subinterfaces:
    AttributeTree, AuthorTree, BlockTagTree, CommentTree, DeprecatedTree, DocCommentTree, DocRootTree, EndElementTree, EntityTree, ErroneousTree, IdentifierTree, InheritDocTree, InlineTagTree, LinkTree, LiteralTree, ParamTree, ReferenceTree, ReturnTree, SeeTree, SerialDataTree, SerialFieldTree, SerialTree, SinceTree, StartElementTree, TextTree, ThrowsTree, UnknownBlockTagTree, UnknownInlineTagTree, ValueTree, VersionTree

      @Exported
      public interface DocTree

  Common interface for all nodes in a documentation syntax tree.
  Since:
    1.8

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `DocTree.Kind`

  - ### Method Summary

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

- - ### Method Detail

    - #### getKind

          DocTree.Kind getKind()

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

    - #### accept

          <R,D> R accept(DocTreeVisitor<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, 2026, Oracle and/or its affiliates. All rights reserved.