Module jdk.compiler
Package com.sun.source.util

# Class SimpleDocTreeVisitor<R,P>

java.lang.Object
com.sun.source.util.SimpleDocTreeVisitor<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 Implemented Interfaces:
  `DocTreeVisitor<R,P>`

public class SimpleDocTreeVisitor<R,P> extends Object implements DocTreeVisitor<R,P>
A simple visitor for tree nodes.

Since:
  1.8

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final R`
  `DEFAULT_VALUE`
  The default value, returned by the `default action`.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SimpleDocTreeVisitor()`
  Creates a visitor, with a DEFAULT_VALUE of `null`.
  `protected`
  `SimpleDocTreeVisitor(R defaultValue)`
  Creates a visitor, with a specified DEFAULT_VALUE.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected R`
  `defaultAction(DocTree node, P p)`
  The default action, used by all visit methods that are not overridden.
  `final R`
  `visit(DocTree node, P p)`
  Invokes the appropriate visit method specific to the type of the node.
  `final R`
  `visit(Iterable<? extends DocTree> nodes, P p)`
  Invokes the appropriate visit method on each of a sequence of nodes.
  `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.
  `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.
  `R`
  `visitEscape(EscapeTree node, P p)`
  Visits an `EscapeTree` node.
  `R`
  `visitHidden(HiddenTree node, P p)`
  Visits a `HiddenTree` node.
  `R`
  `visitIdentifier(IdentifierTree node, P p)`
  Visits an `IdentifierTree` node.
  `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.
  `R`
  `visitProvides(ProvidesTree node, P p)`
  Visits a `ProvidesTree` 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.
  `R`
  `visitSnippet(SnippetTree node, P p)`
  Visits a `SnippetTree` node.
  `R`
  `visitSpec(SpecTree node, P p)`
  Visits a `SpecTree` node.
  `R`
  `visitStartElement(StartElementTree node, P p)`
  Visits a `StartElementTree` node.
  `R`
  `visitSummary(SummaryTree node, P p)`
  Visits a `SummaryTree` node.
  `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.
  `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.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_VALUE

    protected final R DEFAULT_VALUE
    The default value, returned by the `default action`.

- ## Constructor Details

  - ### SimpleDocTreeVisitor

    protected SimpleDocTreeVisitor()
    Creates a visitor, with a DEFAULT_VALUE of `null`.

  - ### SimpleDocTreeVisitor

    protected SimpleDocTreeVisitor(R defaultValue)
    Creates a visitor, with a specified DEFAULT_VALUE.
    Parameters:
      `defaultValue` - the default value to be returned by the default action

- ## Method Details

  - ### defaultAction

    protected R defaultAction(DocTree node, P p)
    The default action, used by all visit methods that are not overridden.
    Parameters:
      `node` - the node being visited
      `p` - the parameter value passed to the visit method
    Returns:
      the result value to be returned from the visit method

  - ### visit

    public final R visit(DocTree node, P p)
    Invokes the appropriate visit method specific to the type of the node.
    Parameters:
      `node` - the node on which to dispatch
      `p` - a parameter to be passed to the appropriate visit method
    Returns:
      the value returns from the appropriate visit method

  - ### visit

    public final R visit(Iterable<? extends DocTree> nodes, P p)
    Invokes the appropriate visit method on each of a sequence of nodes.
    Parameters:
      `nodes` - the nodes on which to dispatch
      `p` - a parameter value to be passed to each appropriate visit method
    Returns:
      the value return from the last of the visit methods, or null if none were called

  - ### visitAttribute

    public R visitAttribute(AttributeTree node, P p)
    Visits an `AttributeTree` node.
    Specified by:
      `visitAttribute` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitAuthor

    public R visitAuthor(AuthorTree node, P p)
    Visits an `AuthorTree` node.
    Specified by:
      `visitAuthor` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitComment

    public R visitComment(CommentTree node, P p)
    Visits a `CommentTree` node.
    Specified by:
      `visitComment` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitDeprecated

    public R visitDeprecated(DeprecatedTree node, P p)
    Visits a `DeprecatedTree` node.
    Specified by:
      `visitDeprecated` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitDocComment

    public R visitDocComment(DocCommentTree node, P p)
    Visits a `DocCommentTree` node.
    Specified by:
      `visitDocComment` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitDocRoot

    public R visitDocRoot(DocRootTree node, P p)
    Visits a `DocRootTree` node.
    Specified by:
      `visitDocRoot` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitDocType

    public R visitDocType(DocTypeTree node, P p)
    Visits a `DocTypeTree` node.
    Specified by:
      `visitDocType` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      10

  - ### visitEndElement

    public R visitEndElement(EndElementTree node, P p)
    Visits an `EndElementTree` node.
    Specified by:
      `visitEndElement` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitEntity

    public R visitEntity(EntityTree node, P p)
    Visits an `EntityTree` node.
    Specified by:
      `visitEntity` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitErroneous

    public R visitErroneous(ErroneousTree node, P p)
    Visits an `ErroneousTree` node.
    Specified by:
      `visitErroneous` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitEscape

    public R visitEscape(EscapeTree node, P p)
    Visits an `EscapeTree` node.
    Specified by:
      `visitEscape` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      21

  - ### visitHidden

    public R visitHidden(HiddenTree node, P p)
    Visits a `HiddenTree` node.
    Specified by:
      `visitHidden` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      9

  - ### visitIdentifier

    public R visitIdentifier(IdentifierTree node, P p)
    Visits an `IdentifierTree` node.
    Specified by:
      `visitIdentifier` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitIndex

    public R visitIndex(IndexTree node, P p)
    Visits an `IndexTree` node.
    Specified by:
      `visitIndex` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      9

  - ### visitInheritDoc

    public R visitInheritDoc(InheritDocTree node, P p)
    Visits an `InheritDocTree` node.
    Specified by:
      `visitInheritDoc` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitLink

    public R visitLink(LinkTree node, P p)
    Visits a `LinkTree` node.
    Specified by:
      `visitLink` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitLiteral

    public R visitLiteral(LiteralTree node, P p)
    Visits an `LiteralTree` node.
    Specified by:
      `visitLiteral` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitParam

    public R visitParam(ParamTree node, P p)
    Visits a `ParamTree` node.
    Specified by:
      `visitParam` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitProvides

    public R visitProvides(ProvidesTree node, P p)
    Visits a `ProvidesTree` node.
    Specified by:
      `visitProvides` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      9

  - ### visitReference

    public R visitReference(ReferenceTree node, P p)
    Visits a `ReferenceTree` node.
    Specified by:
      `visitReference` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitReturn

    public R visitReturn(ReturnTree node, P p)
    Visits a `ReturnTree` node.
    Specified by:
      `visitReturn` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSee

    public R visitSee(SeeTree node, P p)
    Visits a `SeeTree` node.
    Specified by:
      `visitSee` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSerial

    public R visitSerial(SerialTree node, P p)
    Visits a `SerialTree` node.
    Specified by:
      `visitSerial` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSerialData

    public R visitSerialData(SerialDataTree node, P p)
    Visits a `SerialDataTree` node.
    Specified by:
      `visitSerialData` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSerialField

    public R visitSerialField(SerialFieldTree node, P p)
    Visits a `SerialFieldTree` node.
    Specified by:
      `visitSerialField` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSince

    public R visitSince(SinceTree node, P p)
    Visits a `SinceTree` node.
    Specified by:
      `visitSince` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSnippet

    public R visitSnippet(SnippetTree node, P p)
    Visits a `SnippetTree` node.
    Specified by:
      `visitSnippet` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      18

  - ### visitSpec

    public R visitSpec(SpecTree node, P p)
    Visits a `SpecTree` node.
    Specified by:
      `visitSpec` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      20

  - ### visitStartElement

    public R visitStartElement(StartElementTree node, P p)
    Visits a `StartElementTree` node.
    Specified by:
      `visitStartElement` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitSummary

    public R visitSummary(SummaryTree node, P p)
    Visits a `SummaryTree` node.
    Specified by:
      `visitSummary` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      10

  - ### visitSystemProperty

    public R visitSystemProperty(SystemPropertyTree node, P p)
    Visits a `SystemPropertyTree` node.
    Specified by:
      `visitSystemProperty` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      12

  - ### visitText

    public R visitText(TextTree node, P p)
    Visits a `TextTree` node.
    Specified by:
      `visitText` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitThrows

    public R visitThrows(ThrowsTree node, P p)
    Visits a `ThrowsTree` node.
    Specified by:
      `visitThrows` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitUnknownBlockTag

    public R visitUnknownBlockTag(UnknownBlockTagTree node, P p)
    Visits an `UnknownBlockTagTree` node.
    Specified by:
      `visitUnknownBlockTag` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitUnknownInlineTag

    public R visitUnknownInlineTag(UnknownInlineTagTree node, P p)
    Visits an `UnknownInlineTagTree` node.
    Specified by:
      `visitUnknownInlineTag` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitUses

    public R visitUses(UsesTree node, P p)
    Visits a `UsesTree` node.
    Specified by:
      `visitUses` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`
    Since:
      9

  - ### visitValue

    public R visitValue(ValueTree node, P p)
    Visits a `ValueTree` node.
    Specified by:
      `visitValue` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitVersion

    public R visitVersion(VersionTree node, P p)
    Visits a `VersionTree` node.
    Specified by:
      `visitVersion` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`

  - ### visitOther

    public 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.
    Specified by:
      `visitOther` in interface `DocTreeVisitor<R,P>`
    Implementation Requirements:
      This implementation calls `defaultAction`.
    Parameters:
      `node` - the node being visited
      `p` - a parameter value
    Returns:
      the result of `defaultAction`