DocTreeVisitor (Java SE 26 & JDK 26)
Description: declaration: module: jdk.compiler, package: com.sun.source.doctree, interface: DocTreeVisitor
Keywords: com.sun.source.doctree.DocTreeVisitor interface

# Interface DocTreeVisitor<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:
  `DocTreePathScanner, DocTreeScanner, SimpleDocTreeVisitor`

public interface DocTreeVisitor<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, doc comment 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.8

- ## Method Summary

  Modifier and Type
  Method
  Description
  `R`
  `visitAttribute(AttributeTree node, P p)`
  Visits an `AttributeTree` node.
  `R`
  `visitAuthor(AuthorTree node, P p)`
  Visits an `AuthorTree` node.
  `R`
  `visitComment(CommentTree node, P p)`
  Visits a `CommentTree` node.
  `R`
  `visitDeprecated(DeprecatedTree node, P p)`
  Visits a `DeprecatedTree` node.
  `R`
  `visitDocComment(DocCommentTree node, P p)`
  Visits a `DocCommentTree` node.
  `R`
  `visitDocRoot(DocRootTree node, P p)`
  Visits a `DocRootTree` node.
  `default R`
  `visitDocType(DocTypeTree node, P p)`
  Visits a `DocTypeTree` node.
  `R`
  `visitEndElement(EndElementTree node, P p)`
  Visits an `EndElementTree` node.
  `R`
  `visitEntity(EntityTree node, P p)`
  Visits an `EntityTree` node.
  `R`
  `visitErroneous(ErroneousTree node, P p)`
  Visits an `ErroneousTree` node.
  `default R`
  `visitEscape(EscapeTree node, P p)`
  Visits an `EscapeTree` node.
  `default R`
  `visitHidden(HiddenTree node, P p)`
  Visits a `HiddenTree` node.
  `R`
  `visitIdentifier(IdentifierTree node, P p)`
  Visits an `IdentifierTree` node.
  `default R`
  `visitIndex(IndexTree node, P p)`
  Visits an `IndexTree` node.
  `R`
  `visitInheritDoc(InheritDocTree node, P p)`
  Visits an `InheritDocTree` node.
  `R`
  `visitLink(LinkTree node, P p)`
  Visits a `LinkTree` node.
  `R`
  `visitLiteral(LiteralTree node, P p)`
  Visits an `LiteralTree` node.
  `R`
  `visitOther(DocTree node, P p)`
  Visits an unknown type of `DocTree` node.
  `R`
  `visitParam(ParamTree node, P p)`
  Visits a `ParamTree` node.
  `default R`
  `visitProvides(ProvidesTree node, P p)`
  Visits a `ProvidesTree` node.
  `default R`
  `visitRawText(RawTextTree node, P p)`
  Visits a `RawTextTree` node.
  `R`
  `visitReference(ReferenceTree node, P p)`
  Visits a `ReferenceTree` node.
  `R`
  `visitReturn(ReturnTree node, P p)`
  Visits a `ReturnTree` node.
  `R`
  `visitSee(SeeTree node, P p)`
  Visits a `SeeTree` node.
  `R`
  `visitSerial(SerialTree node, P p)`
  Visits a `SerialTree` node.
  `R`
  `visitSerialData(SerialDataTree node, P p)`
  Visits a `SerialDataTree` node.
  `R`
  `visitSerialField(SerialFieldTree node, P p)`
  Visits a `SerialFieldTree` node.
  `R`
  `visitSince(SinceTree node, P p)`
  Visits a `SinceTree` node.
  `default R`
  `visitSnippet(SnippetTree node, P p)`
  Visits a `SnippetTree` node.
  `default R`
  `visitSpec(SpecTree node, P p)`
  Visits a `SpecTree` node.
  `R`
  `visitStartElement(StartElementTree node, P p)`
  Visits a `StartElementTree` node.
  `default R`
  `visitSummary(SummaryTree node, P p)`
  Visits a `SummaryTree` node.
  `default R`
  `visitSystemProperty(SystemPropertyTree node, P p)`
  Visits a `SystemPropertyTree` node.
  `R`
  `visitText(TextTree node, P p)`
  Visits a `TextTree` node.
  `R`
  `visitThrows(ThrowsTree node, P p)`
  Visits a `ThrowsTree` node.
  `R`
  `visitUnknownBlockTag(UnknownBlockTagTree node, P p)`
  Visits an `UnknownBlockTagTree` node.
  `R`
  `visitUnknownInlineTag(UnknownInlineTagTree node, P p)`
  Visits an `UnknownInlineTagTree` node.
  `default R`
  `visitUses(UsesTree node, P p)`
  Visits a `UsesTree` node.
  `R`
  `visitValue(ValueTree node, P p)`
  Visits a `ValueTree` node.
  `R`
  `visitVersion(VersionTree node, P p)`
  Visits a `VersionTree` node.

- ## Method Details

  - ### visitAttribute

    R visitAttribute(AttributeTree node, P p)
    Visits an `AttributeTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitAuthor

    R visitAuthor(AuthorTree node, P p)
    Visits an `AuthorTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitComment

    R visitComment(CommentTree node, P p)
    Visits a `CommentTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitDeprecated

    R visitDeprecated(DeprecatedTree node, P p)
    Visits a `DeprecatedTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitDocComment

    R visitDocComment(DocCommentTree node, P p)
    Visits a `DocCommentTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitDocRoot

    R visitDocRoot(DocRootTree node, P p)
    Visits a `DocRootTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitDocType

    default R visitDocType(DocTypeTree node, P p)
    Visits a `DocTypeTree` node.
    Implementation Requirements:
      Visits the provided `DocTypeTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      10

  - ### visitEndElement

    R visitEndElement(EndElementTree node, P p)
    Visits an `EndElementTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitEntity

    R visitEntity(EntityTree node, P p)
    Visits an `EntityTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitErroneous

    R visitErroneous(ErroneousTree node, P p)
    Visits an `ErroneousTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitEscape

    default R visitEscape(EscapeTree node, P p)
    Visits an `EscapeTree` node.
    Implementation Requirements:
      Visits the provided `EscapeTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      21

  - ### visitHidden

    default R visitHidden(HiddenTree node, P p)
    Visits a `HiddenTree` node.
    Implementation Requirements:
      Visits the provided `HiddenTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      9

  - ### visitIdentifier

    R visitIdentifier(IdentifierTree node, P p)
    Visits an `IdentifierTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitIndex

    default R visitIndex(IndexTree node, P p)
    Visits an `IndexTree` node.
    Implementation Requirements:
      Visits the provided `IndexTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      9

  - ### visitInheritDoc

    R visitInheritDoc(InheritDocTree node, P p)
    Visits an `InheritDocTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitLink

    R visitLink(LinkTree node, P p)
    Visits a `LinkTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitLiteral

    R visitLiteral(LiteralTree node, P p)
    Visits an `LiteralTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitParam

    R visitParam(ParamTree node, P p)
    Visits a `ParamTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitProvides

    default R visitProvides(ProvidesTree node, P p)
    Visits a `ProvidesTree` node.
    Implementation Requirements:
      Visits the provided `ProvidesTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      9

  - ### visitRawText

    default R visitRawText(RawTextTree node, P p)
    Visits a `RawTextTree` node.
    Implementation Requirements:
      Visits the provided `RawTextTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      23

  - ### visitReference

    R visitReference(ReferenceTree node, P p)
    Visits a `ReferenceTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitReturn

    R visitReturn(ReturnTree node, P p)
    Visits a `ReturnTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSee

    R visitSee(SeeTree node, P p)
    Visits a `SeeTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSerial

    R visitSerial(SerialTree node, P p)
    Visits a `SerialTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSerialData

    R visitSerialData(SerialDataTree node, P p)
    Visits a `SerialDataTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSerialField

    R visitSerialField(SerialFieldTree node, P p)
    Visits a `SerialFieldTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSince

    R visitSince(SinceTree node, P p)
    Visits a `SinceTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSnippet

    default R visitSnippet(SnippetTree node, P p)
    Visits a `SnippetTree` node.
    Implementation Requirements:
      Visits the provided `SnippetTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      18

  - ### visitSpec

    default R visitSpec(SpecTree node, P p)
    Visits a `SpecTree` node.
    Implementation Requirements:
      Visits the provided `SpecTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      20

  - ### visitStartElement

    R visitStartElement(StartElementTree node, P p)
    Visits a `StartElementTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitSummary

    default R visitSummary(SummaryTree node, P p)
    Visits a `SummaryTree` node.
    Implementation Requirements:
      Visits the provided `SummaryTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      10

  - ### visitSystemProperty

    default R visitSystemProperty(SystemPropertyTree node, P p)
    Visits a `SystemPropertyTree` node.
    Implementation Requirements:
      Visits the provided `SystemPropertyTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      12

  - ### visitText

    R visitText(TextTree node, P p)
    Visits a `TextTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitThrows

    R visitThrows(ThrowsTree node, P p)
    Visits a `ThrowsTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitUnknownBlockTag

    R visitUnknownBlockTag(UnknownBlockTagTree node, P p)
    Visits an `UnknownBlockTagTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitUnknownInlineTag

    R visitUnknownInlineTag(UnknownInlineTagTree node, P p)
    Visits an `UnknownInlineTagTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitUses

    default R visitUses(UsesTree node, P p)
    Visits a `UsesTree` node.
    Implementation Requirements:
      Visits a `UsesTree` node by calling `visitOther(node, p)`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value
    Since:
      9

  - ### visitValue

    R visitValue(ValueTree node, P p)
    Visits a `ValueTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitVersion

    R visitVersion(VersionTree node, P p)
    Visits a `VersionTree` node.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value

  - ### visitOther

    R visitOther(DocTree node, P p)
    Visits an unknown type of `DocTree` node. This can occur if the set of tags evolves and new kinds of nodes are added to the `DocTree` hierarchy.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      a result value