java.lang.Object
com.sun.source.util.DocTreeScanner<R,P>
- Type Parameters:
R- the return type of this visitor's methods. UseVoidfor visitors that do not need to return results.P- the type of the additional parameter to this visitor's methods. UseVoidfor visitors that do not need an additional parameter.
- All Implemented Interfaces:
DocTreeVisitor<R,P>
- Direct Known Subclasses:
DocTreePathScanner
A DocTreeVisitor that visits all the child tree nodes.
To visit nodes of a particular type, just override the
corresponding visitXYZ method.
Inside your method, call super.visitXYZ to visit descendant
nodes.
Here is an example to count the number of erroneous nodes in a tree:
class CountErrors extends DocTreeScanner<Integer,Void> {
@Override
public Integer visitErroneous(ErroneousTree node, Void p) {
return 1;
}
@Override
public Integer reduce(Integer r1, Integer r2) {
return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
}
}
- Since:
- 1.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReduces two results into a combined result.Scans a single node.Scans a sequence of nodes.visitAttribute(AttributeTree node, P p) Visits anAttributeTreenode.visitAuthor(AuthorTree node, P p) Visits anAuthorTreenode.visitComment(CommentTree node, P p) Visits aCommentTreenode.visitDeprecated(DeprecatedTree node, P p) Visits aDeprecatedTreenode.visitDocComment(DocCommentTree node, P p) Visits aDocCommentTreenode.visitDocRoot(DocRootTree node, P p) Visits aDocRootTreenode.visitDocType(DocTypeTree node, P p) Visits aDocTypeTreenode.visitEndElement(EndElementTree node, P p) Visits anEndElementTreenode.visitEntity(EntityTree node, P p) Visits anEntityTreenode.visitErroneous(ErroneousTree node, P p) Visits anErroneousTreenode.visitEscape(EscapeTree node, P p) Visits anEscapeTreenode.visitHidden(HiddenTree node, P p) Visits aHiddenTreenode.visitIdentifier(IdentifierTree node, P p) Visits anIdentifierTreenode.visitIndex(IndexTree node, P p) Visits anIndexTreenode.visitInheritDoc(InheritDocTree node, P p) Visits anInheritDocTreenode.Visits aLinkTreenode.visitLiteral(LiteralTree node, P p) Visits anLiteralTreenode.visitOther(DocTree node, P p) Visits an unknown type ofDocTreenode.visitParam(ParamTree node, P p) Visits aParamTreenode.visitProvides(ProvidesTree node, P p) Visits aProvidesTreenode.visitReference(ReferenceTree node, P p) Visits aReferenceTreenode.visitReturn(ReturnTree node, P p) Visits aReturnTreenode.Visits aSeeTreenode.visitSerial(SerialTree node, P p) Visits aSerialTreenode.visitSerialData(SerialDataTree node, P p) Visits aSerialDataTreenode.visitSerialField(SerialFieldTree node, P p) Visits aSerialFieldTreenode.visitSince(SinceTree node, P p) Visits aSinceTreenode.visitSnippet(SnippetTree node, P p) Visits aSnippetTreenode.Visits aSpecTreenode.visitStartElement(StartElementTree node, P p) Visits aStartElementTreenode.visitSummary(SummaryTree node, P p) Visits aSummaryTreenode.visitSystemProperty(SystemPropertyTree node, P p) Visits aSystemPropertyTreenode.Visits aTextTreenode.visitThrows(ThrowsTree node, P p) Visits aThrowsTreenode.visitUnknownBlockTag(UnknownBlockTagTree node, P p) Visits anUnknownBlockTagTreenode.visitUnknownInlineTag(UnknownInlineTagTree node, P p) Visits anUnknownInlineTagTreenode.Visits aUsesTreenode.visitValue(ValueTree node, P p) Visits aValueTreenode.visitVersion(VersionTree node, P p) Visits aVersionTreenode.
-
Constructor Details
-
DocTreeScanner
public DocTreeScanner()Constructs aDocTreeScanner.
-
-
Method Details
-
scan
Scans a single node.- Parameters:
node- the node to be scannedp- a parameter value passed to the visit method- Returns:
- the result value from the visit method
-
scan
Scans a sequence of nodes.- Parameters:
nodes- the nodes to be scannedp- a parameter value to be passed to the visit method for each node- Returns:
- the combined return value from the visit methods.
The values are combined using the
reducemethod.
-
reduce
Reduces two results into a combined result. The default implementation is to return the first parameter. The general contract of the method is that it may take any action whatsoever.- Parameters:
r1- the first of the values to be combinedr2- the second of the values to be combined- Returns:
- the result of combining the two parameters
-
visitAttribute
Visits anAttributeTreenode.- Specified by:
visitAttributein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitAuthor
Visits anAuthorTreenode.- Specified by:
visitAuthorin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitComment
Visits aCommentTreenode.- Specified by:
visitCommentin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitDeprecated
Visits aDeprecatedTreenode.- Specified by:
visitDeprecatedin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitDocComment
Visits aDocCommentTreenode.- Specified by:
visitDocCommentin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitDocRoot
Visits aDocRootTreenode.- Specified by:
visitDocRootin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitDocType
Visits aDocTypeTreenode.- Specified by:
visitDocTypein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitEndElement
Visits anEndElementTreenode.- Specified by:
visitEndElementin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitEntity
Visits anEntityTreenode.- Specified by:
visitEntityin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitErroneous
Visits anErroneousTreenode.- Specified by:
visitErroneousin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitEscape
Visits anEscapeTreenode.- Specified by:
visitEscapein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
- Since:
- 21
-
visitHidden
Visits aHiddenTreenode.- Specified by:
visitHiddenin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitIdentifier
Visits anIdentifierTreenode.- Specified by:
visitIdentifierin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitIndex
Visits anIndexTreenode.- Specified by:
visitIndexin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitInheritDoc
Visits anInheritDocTreenode.- Specified by:
visitInheritDocin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitLink
Visits aLinkTreenode.- Specified by:
visitLinkin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitLiteral
Visits anLiteralTreenode.- Specified by:
visitLiteralin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitParam
Visits aParamTreenode.- Specified by:
visitParamin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitProvides
Visits aProvidesTreenode.- Specified by:
visitProvidesin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitReference
Visits aReferenceTreenode.- Specified by:
visitReferencein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitReturn
Visits aReturnTreenode.- Specified by:
visitReturnin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSee
Visits aSeeTreenode.- Specified by:
visitSeein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSerial
Visits aSerialTreenode.- Specified by:
visitSerialin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSerialData
Visits aSerialDataTreenode.- Specified by:
visitSerialDatain interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSerialField
Visits aSerialFieldTreenode.- Specified by:
visitSerialFieldin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSince
Visits aSinceTreenode.- Specified by:
visitSincein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSnippet
Visits aSnippetTreenode.- Specified by:
visitSnippetin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
- Since:
- 18
-
visitSpec
Visits aSpecTreenode.- Specified by:
visitSpecin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
- Since:
- 20
-
visitStartElement
Visits aStartElementTreenode.- Specified by:
visitStartElementin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitSummary
Visits aSummaryTreenode.- Specified by:
visitSummaryin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
- Since:
- 10
-
visitSystemProperty
Visits aSystemPropertyTreenode.- Specified by:
visitSystemPropertyin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
- Since:
- 12
-
visitText
Visits aTextTreenode.- Specified by:
visitTextin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitThrows
Visits aThrowsTreenode.- Specified by:
visitThrowsin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitUnknownBlockTag
Visits anUnknownBlockTagTreenode.- Specified by:
visitUnknownBlockTagin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitUnknownInlineTag
Visits anUnknownInlineTagTreenode.- Specified by:
visitUnknownInlineTagin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitUses
Visits aUsesTreenode.- Specified by:
visitUsesin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitValue
Visits aValueTreenode.- Specified by:
visitValuein interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitVersion
Visits aVersionTreenode.- Specified by:
visitVersionin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-
visitOther
Visits an unknown type ofDocTreenode. This can occur if the set of tags evolves and new kinds of nodes are added to theDocTreehierarchy.- Specified by:
visitOtherin interfaceDocTreeVisitor<R,P> - Parameters:
node- the node being visitedp- a parameter value- Returns:
- the result of scanning
-