DocTreePathScanner (Java SE 26 & JDK 26)
Description: declaration: module: jdk.compiler, package: com.sun.source.util, class: DocTreePathScanner
Keywords: com.sun.source.util.DocTreePathScanner class

# Class DocTreePathScanner<R,P>

java.lang.Object
com.sun.source.util.DocTreeScanner<R,P>
com.sun.source.util.DocTreePathScanner<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 DocTreePathScanner<R,P> extends DocTreeScanner<R,P>
A DocTreeVisitor that visits all the child tree nodes, and provides support for maintaining a path for the parent nodes. To visit nodes of a particular type, just override the corresponding visitorXYZ method. Inside your method, call super.visitXYZ to visit descendant nodes.

Since:
  1.8

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DocTreePathScanner()`
  Constructs a `DocTreePathScanner`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DocTreePath`
  `getCurrentPath()`
  Returns the current path for the node, as built up by the currently active set of scan calls.
  `R`
  `scan(DocTree tree, P p)`
  Scans a single node.
  `R`
  `scan(DocTreePath path, P p)`
  Scans a tree from a position identified by a tree path.

  ### Methods declared in class DocTreeScanner

  `reduce, scan, visitAttribute, visitAuthor, visitComment, visitDeprecated, visitDocComment, visitDocRoot, visitDocType, visitEndElement, visitEntity, visitErroneous, visitEscape, visitHidden, visitIdentifier, visitIndex, visitInheritDoc, visitLink, visitLiteral, visitOther, visitParam, visitProvides, visitRawText, visitReference, visitReturn, visitSee, visitSerial, visitSerialData, visitSerialField, visitSince, visitSnippet, visitSpec, visitStartElement, visitSummary, visitSystemProperty, visitText, visitThrows, visitUnknownBlockTag, visitUnknownInlineTag, visitUses, visitValue, visitVersion`
  Modifier and Type
  Method
  Description
  `R`
  `reduce(R r1, R r2)`
  Reduces two results into a combined result.
  `R`
  `scan(Iterable<? extends DocTree> nodes, P p)`
  Scans 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`
  `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.
  `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 Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Constructor Details

  - ### DocTreePathScanner

    public DocTreePathScanner()
    Constructs a `DocTreePathScanner`.

- ## Method Details

  - ### scan

    public R scan(DocTreePath path, P p)
    Scans a tree from a position identified by a tree path.
    Parameters:
      `path` - the path
      `p` - a value to be passed to visitor methods
    Returns:
      the result returned from the main visitor method

  - ### scan

    public R scan(DocTree tree, P p)
    Scans a single node. The current path is updated for the duration of the scan.
    Overrides:
      `scan` in class `DocTreeScanner<R,P>`
    Parameters:
      `tree` - the tree to be scanned
      `p` - a value to be passed to visitor methods
    Returns:
      the result returned from the main visitor method

  - ### getCurrentPath

    public DocTreePath getCurrentPath()
    Returns the current path for the node, as built up by the currently active set of scan calls.
    Returns:
      the current path