- java.lang.Object
- 
- com.sun.source.util.DocTreeScanner<R,P>
 
- 
- All Implemented Interfaces:
- DocTreeVisitor<R,P>
 - Direct Known Subclasses:
- DocTreePathScanner
 
 public class DocTreeScanner<R,P> extends Object implements DocTreeVisitor<R,P> A TreeVisitor 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.The default implementation of the visitXYZ methods will determine a result as follows: - If the node being visited has no children, the result will be null.
- If the node being visited has one child, the result will be the
 result of calling scanon that child. The child may be a simple node or itself a list of nodes.
-  If the node being visited has more than one child, the result will
 be determined by calling scaneach child in turn, and then combining the result of each scan after the first with the cumulative result so far, as determined by thereduce(R, R)method. Each child may be either a simple node of a list of nodes. The default behavior of thereducemethod is such that the result of the visitXYZ method will be the result of the last child scanned.
 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 SummaryConstructors Constructor Description DocTreeScanner()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Rreduce(R r1, R r2)Reduces two results into a combined result.Rscan(DocTree node, P p)Scans a single node.Rscan(Iterable<? extends DocTree> nodes, P p)Scans a sequence of nodes.RvisitAttribute(AttributeTree node, P p)Visits an AttributeTree node.RvisitAuthor(AuthorTree node, P p)Visits an AuthorTree node.RvisitComment(CommentTree node, P p)Visits a CommentTree node.RvisitDeprecated(DeprecatedTree node, P p)Visits a DeprecatedTree node.RvisitDocComment(DocCommentTree node, P p)Visits a DocCommentTree node.RvisitDocRoot(DocRootTree node, P p)Visits a DocRootTree node.RvisitDocType(DocTypeTree node, P p)Visits a DocTypeTree node.RvisitEndElement(EndElementTree node, P p)Visits an EndElementTree node.RvisitEntity(EntityTree node, P p)Visits an EntityTree node.RvisitErroneous(ErroneousTree node, P p)Visits an ErroneousTree node.RvisitHidden(HiddenTree node, P p)Visits a HiddenTree node.RvisitIdentifier(IdentifierTree node, P p)Visits an IdentifierTree node.RvisitIndex(IndexTree node, P p)Visits an IndexTree node.RvisitInheritDoc(InheritDocTree node, P p)Visits an InheritDocTree node.RvisitLink(LinkTree node, P p)Visits a LinkTree node.RvisitLiteral(LiteralTree node, P p)Visits an LiteralTree node.RvisitOther(DocTree node, P p)Visits an unknown type of DocTree node.RvisitParam(ParamTree node, P p)Visits a ParamTree node.RvisitProvides(ProvidesTree node, P p)Visits a ProvidesTree node.RvisitReference(ReferenceTree node, P p)Visits a ReferenceTree node.RvisitReturn(ReturnTree node, P p)Visits a ReturnTree node.RvisitSee(SeeTree node, P p)Visits a SeeTree node.RvisitSerial(SerialTree node, P p)Visits a SerialTree node.RvisitSerialData(SerialDataTree node, P p)Visits a SerialDataTree node.RvisitSerialField(SerialFieldTree node, P p)Visits a SerialFieldTree node.RvisitSince(SinceTree node, P p)Visits a SinceTree node.RvisitStartElement(StartElementTree node, P p)Visits a StartElementTree node.RvisitSummary(SummaryTree node, P p)Visits a SummaryTree node.RvisitText(TextTree node, P p)Visits a TextTree node.RvisitThrows(ThrowsTree node, P p)Visits a ThrowsTree node.RvisitUnknownBlockTag(UnknownBlockTagTree node, P p)Visits an UnknownBlockTagTree node.RvisitUnknownInlineTag(UnknownInlineTagTree node, P p)Visits an UnknownInlineTagTree node.RvisitUses(UsesTree node, P p)Visits a UsesTree node.RvisitValue(ValueTree node, P p)Visits a ValueTree node.RvisitVersion(VersionTree node, P p)Visits a VersionTreeTree node.
 
- 
- 
- 
Method Detail- 
scanpublic R scan(DocTree node, P p) Scans a single node.- Parameters:
- node- the node to be scanned
- p- a parameter value passed to the visit method
- Returns:
- the result value from the visit method
 
 - 
scanpublic R scan(Iterable<? extends DocTree> nodes, P p) Scans a sequence of nodes.- Parameters:
- nodes- the nodes to be scanned
- p- 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.
 
 - 
reducepublic R reduce(R r1, R r2) 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 combined
- r2- the second of the values to be combined
- Returns:
- the result of combining the two parameters
 
 - 
visitAttributepublic R visitAttribute(AttributeTree node, P p) Visits an AttributeTree node. This implementation returnsnull.- Specified by:
- visitAttributein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitAuthorpublic R visitAuthor(AuthorTree node, P p) Visits an AuthorTree node. This implementation scans the children in left to right order.- Specified by:
- visitAuthorin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitCommentpublic R visitComment(CommentTree node, P p) Visits a CommentTree node. This implementation returnsnull.- Specified by:
- visitCommentin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitDeprecatedpublic R visitDeprecated(DeprecatedTree node, P p) Visits a DeprecatedTree node. This implementation scans the children in left to right order.- Specified by:
- visitDeprecatedin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitDocCommentpublic R visitDocComment(DocCommentTree node, P p) Visits a DocCommentTree node. This implementation scans the children in left to right order.- Specified by:
- visitDocCommentin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitDocRootpublic R visitDocRoot(DocRootTree node, P p) Visits a DocRootTree node. This implementation returnsnull.- Specified by:
- visitDocRootin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitDocTypepublic R visitDocType(DocTypeTree node, P p) Visits a DocTypeTree node. This implementation returnsnull.- Specified by:
- visitDocTypein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitEndElementpublic R visitEndElement(EndElementTree node, P p) Visits an EndElementTree node. This implementation returnsnull.- Specified by:
- visitEndElementin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitEntitypublic R visitEntity(EntityTree node, P p) Visits an EntityTree node. This implementation returnsnull.- Specified by:
- visitEntityin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitErroneouspublic R visitErroneous(ErroneousTree node, P p) Visits an ErroneousTree node. This implementation returnsnull.- Specified by:
- visitErroneousin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitHiddenpublic R visitHidden(HiddenTree node, P p) Visits a HiddenTree node. This implementation scans the children in left to right order.- Specified by:
- visitHiddenin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitIdentifierpublic R visitIdentifier(IdentifierTree node, P p) Visits an IdentifierTree node. This implementation returnsnull.- Specified by:
- visitIdentifierin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitIndexpublic R visitIndex(IndexTree node, P p) Visits an IndexTree node. This implementation returnsnull.- Specified by:
- visitIndexin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitInheritDocpublic R visitInheritDoc(InheritDocTree node, P p) Visits an InheritDocTree node. This implementation returnsnull.- Specified by:
- visitInheritDocin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitLinkpublic R visitLink(LinkTree node, P p) Visits a LinkTree node. This implementation scans the children in left to right order.- Specified by:
- visitLinkin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitLiteralpublic R visitLiteral(LiteralTree node, P p) Visits an LiteralTree node. This implementation returnsnull.- Specified by:
- visitLiteralin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitParampublic R visitParam(ParamTree node, P p) Visits a ParamTree node. This implementation scans the children in left to right order.- Specified by:
- visitParamin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitProvidespublic R visitProvides(ProvidesTree node, P p) Visits a ProvidesTree node. This implementation scans the children in left to right order.- Specified by:
- visitProvidesin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitReferencepublic R visitReference(ReferenceTree node, P p) Visits a ReferenceTree node. This implementation returnsnull.- Specified by:
- visitReferencein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitReturnpublic R visitReturn(ReturnTree node, P p) Visits a ReturnTree node. This implementation scans the children in left to right order.- Specified by:
- visitReturnin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSeepublic R visitSee(SeeTree node, P p) Visits a SeeTree node. This implementation scans the children in left to right order.- Specified by:
- visitSeein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSerialpublic R visitSerial(SerialTree node, P p) Visits a SerialTree node. This implementation scans the children in left to right order.- Specified by:
- visitSerialin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSerialDatapublic R visitSerialData(SerialDataTree node, P p) Visits a SerialDataTree node. This implementation scans the children in left to right order.- Specified by:
- visitSerialDatain interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSerialFieldpublic R visitSerialField(SerialFieldTree node, P p) Visits a SerialFieldTree node. This implementation scans the children in left to right order.- Specified by:
- visitSerialFieldin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSincepublic R visitSince(SinceTree node, P p) Visits a SinceTree node. This implementation scans the children in left to right order.- Specified by:
- visitSincein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitStartElementpublic R visitStartElement(StartElementTree node, P p) Visits a StartElementTree node. This implementation scans the children in left to right order.- Specified by:
- visitStartElementin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitSummarypublic R visitSummary(SummaryTree node, P p) Visits a SummaryTree node. This implementation scans the children in left to right order.- Specified by:
- visitSummaryin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
- Since:
- 10
 
 - 
visitTextpublic R visitText(TextTree node, P p) Visits a TextTree node. This implementation returnsnull.- Specified by:
- visitTextin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitThrowspublic R visitThrows(ThrowsTree node, P p) Visits a ThrowsTree node. This implementation scans the children in left to right order.- Specified by:
- visitThrowsin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitUnknownBlockTagpublic R visitUnknownBlockTag(UnknownBlockTagTree node, P p) Visits an UnknownBlockTagTree node. This implementation scans the children in left to right order.- Specified by:
- visitUnknownBlockTagin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitUnknownInlineTagpublic R visitUnknownInlineTag(UnknownInlineTagTree node, P p) Visits an UnknownInlineTagTree node. This implementation scans the children in left to right order.- Specified by:
- visitUnknownInlineTagin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitUsespublic R visitUses(UsesTree node, P p) Visits a UsesTree node. This implementation scans the children in left to right order.- Specified by:
- visitUsesin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitValuepublic R visitValue(ValueTree node, P p) Visits a ValueTree node. This implementation scans the children in left to right order.- Specified by:
- visitValuein interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitVersionpublic R visitVersion(VersionTree node, P p) Visits a VersionTreeTree node. This implementation scans the children in left to right order.- Specified by:
- visitVersionin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 - 
visitOtherpublic 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 theDocTreehierarchy. This implementation returnsnull.- Specified by:
- visitOtherin interface- DocTreeVisitor<R,P>
- Parameters:
- node- the node being visited
- p- a parameter value
- Returns:
- the result of scanning
 
 
- 
 
-