Interface DocTreeFactory
public interface DocTreeFactory
Factory for creating
DocTree nodes.- Implementation Note:
- The methods in an implementation of this interface may only accept
DocTreenodes that have been created by the same implementation. - Since:
- 9
-
Method Summary
Modifier and TypeMethodDescriptionat(int pos) Sets the position to be recorded in subsequent tree nodes created by this factory.getFirstSentence(List<? extends DocTree> list) Gets the first sentence contained in a list of content.newAttributeTree(Name name, AttributeTree.ValueKind vkind, List<? extends DocTree> value) Creates a newAttributeTreeobject, to represent an attribute in an HTML element or tag.newAuthorTree(List<? extends DocTree> name) Creates a newAuthorTreeobject, to represent an@authortag.newCodeTree(TextTree text) Creates a newLiteralTreeobject, to represent a{@code }tag.newCommentTree(String text) Creates a newCommentTree, to represent an HTML comment.newDeprecatedTree(List<? extends DocTree> text) Creates a newDeprecatedTreeobject, to represent an@deprecatedtag.newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) Creates a newDocCommentTreeobject, to represent a complete doc comment.newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags, List<? extends DocTree> preamble, List<? extends DocTree> postamble) Creates a newDocCommentTreeobject, to represent the entire doc comment.Creates a newDocRootTreeobject, to represent an{@docRoot}tag.newDocTypeTree(String text) Creates a newDocTypeTree, to represent aDOCTYPEHTML declaration.newEndElementTree(Name name) Creates a newEndElementobject, to represent the end of an HTML element.newEntityTree(Name name) Creates a newEntityTreeobject, to represent an HTML entity.newErroneousTree(String text, Diagnostic<JavaFileObject> diag) Creates a newErroneousTreeobject, to represent some unparseable input.newEscapeTree(char ch) Creates a newEscapeTreeobject, to represent an escaped character.newExceptionTree(ReferenceTree name, List<? extends DocTree> description) Creates a newThrowsTreeobject, to represent an@exceptiontag.newHiddenTree(List<? extends DocTree> text) Creates a newHiddenTreeobject, to represent an@hiddentag.newIdentifierTree(Name name) Creates a newIdentifierTreeobject, to represent an identifier, such as in a@paramtag.newIndexTree(DocTree term, List<? extends DocTree> description) Creates a newIndexTreeobject, to represent an{@index }tag.Creates a newInheritDocTreeobject, to represent an{@inheritDoc}tag.default InheritDocTreenewInheritDocTree(ReferenceTree supertype) Creates a newInheritDocTreeobject, to represent an{@inheritDoc}tag.newLinkPlainTree(ReferenceTree ref, List<? extends DocTree> label) Creates a newLinkTreeobject, to represent a{@linkplain }tag.newLinkTree(ReferenceTree ref, List<? extends DocTree> label) Creates a newLinkTreeobject, to represent a{@link }tag.newLiteralTree(TextTree text) Creates a newLiteralTreeobject, to represent a{@literal }tag.newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description) Creates a newParamTreeobject, to represent a@paramtag.newProvidesTree(ReferenceTree name, List<? extends DocTree> description) Creates a newProvidesTreeobject, to represent a@providestag.newRawTextTree(DocTree.Kind kind, String code) Creates a newRawTextTreeobject, to represent a fragment of uninterpreted raw text.newReferenceTree(String signature) Creates a newReferenceTreeobject, to represent a reference to an API element.default ReturnTreenewReturnTree(boolean isInline, List<? extends DocTree> description) Creates a newReturnTreeobject, to represent a@returntag or{@return}tag.newReturnTree(List<? extends DocTree> description) Creates a newReturnTreeobject, to represent a@returntag.newSeeTree(List<? extends DocTree> reference) Creates a newSeeTreeobject, to represent a@seetag.newSerialDataTree(List<? extends DocTree> description) Creates a newSerialDataTreeobject, to represent a@serialDatatag.newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) Creates a newSerialFieldTreeobject, to represent a@serialFieldtag.newSerialTree(List<? extends DocTree> description) Creates a newSerialTreeobject, to represent a@serialtag.newSinceTree(List<? extends DocTree> text) Creates a newSinceTreeobject, to represent a@sincetag.newSnippetTree(List<? extends DocTree> attributes, TextTree text) Creates a newSnippetTreeobject, to represent a{@snippet }tag.newSpecTree(TextTree url, List<? extends DocTree> title) Creates a newSpecTreeobject, to represent an@spectag.newStartElementTree(Name name, List<? extends DocTree> attrs, boolean selfClosing) Creates a newStartElementTreeobject, to represent the start of an HTML element.default SummaryTreenewSummaryTree(List<? extends DocTree> summary) Creates a newSummaryTreeobject, to represent a{@summary }tag.newSystemPropertyTree(Name propertyName) Creates a newSystemPropertyTreeobject, to represent a{@systemProperty }tag.newTextTree(String text) Creates a newTextTreeobject, to represent some plain text.newThrowsTree(ReferenceTree name, List<? extends DocTree> description) Creates a newThrowsTreeobject, to represent a@throwstag.newUnknownBlockTagTree(Name name, List<? extends DocTree> content) Creates a newUnknownBlockTagTreeobject, to represent an unrecognized block tag.newUnknownInlineTagTree(Name name, List<? extends DocTree> content) Creates a newUnknownInlineTagTreeobject, to represent an unrecognized inline tag.newUsesTree(ReferenceTree name, List<? extends DocTree> description) Creates a newUsesTreeobject, to represent a@usestag.Creates a newValueTreeobject, to represent a{@value }tag.default ValueTreenewValueTree(TextTree format, ReferenceTree ref) Creates a newValueTreeobject, to represent a{@value }tag.newVersionTree(List<? extends DocTree> text) Creates a newVersionTreeobject, to represent a{@version }tag.
-
Method Details
-
newAttributeTree
AttributeTree newAttributeTree(Name name, AttributeTree.ValueKind vkind, List<? extends DocTree> value) Creates a newAttributeTreeobject, to represent an attribute in an HTML element or tag.- Parameters:
name- the name of the attributevkind- the kind of the attribute valuevalue- the value, if any, of the attribute- Returns:
- an
AttributeTreeobject
-
newAuthorTree
Creates a newAuthorTreeobject, to represent an@authortag.- Parameters:
name- the name of the author- Returns:
- an
AuthorTreeobject
-
newCodeTree
Creates a newLiteralTreeobject, to represent a{@code }tag.- Parameters:
text- the content of the tag- Returns:
- a
LiteralTreeobject
-
newCommentTree
Creates a newCommentTree, to represent an HTML comment.- Parameters:
text- the content of the comment- Returns:
- a
CommentTreeobject
-
newDeprecatedTree
Creates a newDeprecatedTreeobject, to represent an@deprecatedtag.- Parameters:
text- the content of the tag- Returns:
- a
DeprecatedTreeobject
-
newDocCommentTree
Creates a newDocCommentTreeobject, to represent a complete doc comment.- Parameters:
fullBody- the entire body of the doc commenttags- the block tags in the doc comment- Returns:
- a
DocCommentTreeobject
-
newDocCommentTree
DocCommentTree newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags, List<? extends DocTree> preamble, List<? extends DocTree> postamble) Creates a newDocCommentTreeobject, to represent the entire doc comment.- Parameters:
fullBody- the entire body of the doc commenttags- the block tags in the doc commentpreamble- the meta content of an html file including the body tagpostamble- the meta content of an html including the closing body tag- Returns:
- a
DocCommentTreeobject - Since:
- 10
-
newDocRootTree
DocRootTree newDocRootTree()Creates a newDocRootTreeobject, to represent an{@docRoot}tag.- Returns:
- a
DocRootTreeobject
-
newDocTypeTree
Creates a newDocTypeTree, to represent aDOCTYPEHTML declaration.- Parameters:
text- the content of the declaration- Returns:
- a
DocTypeTreeobject - Since:
- 10
-
newEndElementTree
Creates a newEndElementobject, to represent the end of an HTML element.- Parameters:
name- the name of the HTML element- Returns:
- an
EndElementTreeobject
-
newEntityTree
Creates a newEntityTreeobject, to represent an HTML entity.- Parameters:
name- the name of the entity, representing the characters between '&' and ';' in the representation of the entity in an HTML document- Returns:
- an
EntityTreeobject
-
newErroneousTree
Creates a newErroneousTreeobject, to represent some unparseable input.- Parameters:
text- the unparseable textdiag- a diagnostic associated with the unparseable text, ornull- Returns:
- an
ErroneousTreeobject
-
newEscapeTree
Creates a newEscapeTreeobject, to represent an escaped character.- API Note:
- This method does not itself constrain the set of valid escape sequences,
although the set may be effectively constrained to those defined in the
Documentation Comment Specification for the Standard Doclet,
including the following context-sensitive escape sequences:
@@, representing@, where it would otherwise be treated as introducing a block or inline tag,@/, representing/, as part of*@/to represent*/, and@*, representing*, where it would otherwise be discarded, after whitespace at the beginning of a line.
- Parameters:
ch- the character- Returns:
- an
EscapeTreeobject - Since:
- 21
-
newExceptionTree
Creates a newThrowsTreeobject, to represent an@exceptiontag.- Parameters:
name- the name of the exceptiondescription- a description of why the exception might be thrown- Returns:
- an
ThrowsTreeobject
-
newHiddenTree
Creates a newHiddenTreeobject, to represent an@hiddentag.- Parameters:
text- the content of the tag- Returns:
- a
HiddenTreeobject
-
newIdentifierTree
Creates a newIdentifierTreeobject, to represent an identifier, such as in a@paramtag.- Parameters:
name- the name of the identifier- Returns:
- an
IdentifierTreeobject
-
newIndexTree
-
newInheritDocTree
InheritDocTree newInheritDocTree()Creates a newInheritDocTreeobject, to represent an{@inheritDoc}tag.- Returns:
- an
InheritDocTreeobject
-
newInheritDocTree
Creates a newInheritDocTreeobject, to represent an{@inheritDoc}tag.- Implementation Requirements:
- This implementation throws
UnsupportedOperationException. - Parameters:
supertype- a superclass or superinterface reference- Returns:
- an
InheritDocTreeobject - Since:
- 22
-
newLinkTree
Creates a newLinkTreeobject, to represent a{@link }tag.- Parameters:
ref- the API element being referencedlabel- an optional label for the link- Returns:
- a
LinkTreeobject
-
newLinkPlainTree
Creates a newLinkTreeobject, to represent a{@linkplain }tag.- Parameters:
ref- the API element being referencedlabel- an optional label for the link- Returns:
- a
LinkTreeobject
-
newLiteralTree
Creates a newLiteralTreeobject, to represent a{@literal }tag.- Parameters:
text- the content of the tag- Returns:
- a
LiteralTreeobject
-
newParamTree
ParamTree newParamTree(boolean isTypeParameter, IdentifierTree name, List<? extends DocTree> description) Creates a newParamTreeobject, to represent a@paramtag.- Parameters:
isTypeParameter-trueif this is a type parameter, andfalseotherwisename- the parameter being describeddescription- the description of the parameter- Returns:
- a
ParamTreeobject
-
newProvidesTree
Creates a newProvidesTreeobject, to represent a@providestag.- Parameters:
name- the name of the service typedescription- a description of the service being provided- Returns:
- a
ProvidesTreeobject
-
newRawTextTree
Creates a newRawTextTreeobject, to represent a fragment of uninterpreted raw text.- Parameters:
kind- the kind of textcode- the code- Returns:
- a
RawTextTreeobject - Throws:
IllegalArgumentException- if the kind is not a recognized kind for raw text- Since:
- 23
-
newReferenceTree
Creates a newReferenceTreeobject, to represent a reference to an API element.- Parameters:
signature- the doc comment signature of the reference- Returns:
- a
ReferenceTreeobject
-
newReturnTree
Creates a newReturnTreeobject, to represent a@returntag.- Parameters:
description- the description of the return value of a method- Returns:
- a
ReturnTreeobject
-
newReturnTree
Creates a newReturnTreeobject, to represent a@returntag or{@return}tag.- Implementation Requirements:
- This implementation throws
UnsupportedOperationExceptionifisInlineistrue, and callsnewReturnTree(List)otherwise. - Parameters:
isInline-trueif this instance is as an inline tag, andfalseotherwisedescription- the description of the return value of a method- Returns:
- a
ReturnTreeobject - Throws:
UnsupportedOperationException- if inline{@return}tags are not supported- Since:
- 16
-
newSeeTree
-
newSerialTree
Creates a newSerialTreeobject, to represent a@serialtag.- Parameters:
description- the description for the tag- Returns:
- a
SerialTreeobject
-
newSerialDataTree
Creates a newSerialDataTreeobject, to represent a@serialDatatag.- Parameters:
description- the description for the tag- Returns:
- a
SerialDataTreeobject
-
newSerialFieldTree
SerialFieldTree newSerialFieldTree(IdentifierTree name, ReferenceTree type, List<? extends DocTree> description) Creates a newSerialFieldTreeobject, to represent a@serialFieldtag.- Parameters:
name- the name of the fieldtype- the type of the fielddescription- the description of the field- Returns:
- a
SerialFieldTreeobject
-
newSinceTree
-
newSnippetTree
Creates a newSnippetTreeobject, to represent a{@snippet }tag.- Parameters:
attributes- the attributes of the tagtext- the body of the tag, ornullif the tag has no body (not to be confused with an empty body)- Returns:
- a
SnippetTreeobject - Since:
- 18
-
newSpecTree
-
newStartElementTree
Creates a newStartElementTreeobject, to represent the start of an HTML element.- Parameters:
name- the name of the HTML elementattrs- the attributesselfClosing-trueif the start element is marked as self-closing; otherwisefalse- Returns:
- a
StartElementTreeobject
-
newSummaryTree
Creates a newSummaryTreeobject, to represent a{@summary }tag.- Implementation Requirements:
- This implementation throws
UnsupportedOperationException. - Parameters:
summary- the content of the tag- Returns:
- a
SummaryTreeobject - Since:
- 10
-
newSystemPropertyTree
Creates a newSystemPropertyTreeobject, to represent a{@systemProperty }tag.- Parameters:
propertyName- the system property name- Returns:
- a
SystemPropertyTreeobject - Since:
- 12
-
newTextTree
-
newThrowsTree
Creates a newThrowsTreeobject, to represent a@throwstag.- Parameters:
name- the name of the exceptiondescription- a description of why the exception might be thrown- Returns:
- a
ThrowsTreeobject
-
newUnknownBlockTagTree
Creates a newUnknownBlockTagTreeobject, to represent an unrecognized block tag.- Parameters:
name- the name of the block tagcontent- the content- Returns:
- an
UnknownBlockTagTreeobject
-
newUnknownInlineTagTree
Creates a newUnknownInlineTagTreeobject, to represent an unrecognized inline tag.- Parameters:
name- the name of the inline tagcontent- the content- Returns:
- an
UnknownInlineTagTreeobject
-
newUsesTree
Creates a newUsesTreeobject, to represent a@usestag.- Parameters:
name- the name of the service typedescription- a description of how the service will be used- Returns:
- a
UsesTreeobject
-
newValueTree
Creates a newValueTreeobject, to represent a{@value }tag.- Parameters:
ref- a reference to the value- Returns:
- a
ValueTreeobject
-
newValueTree
Creates a newValueTreeobject, to represent a{@value }tag.- Implementation Requirements:
- This implementation calls
newValueTree(ref). - Parameters:
format- a format string for the valueref- a reference to the value- Returns:
- a
ValueTreeobject - Since:
- 20
-
newVersionTree
Creates a newVersionTreeobject, to represent a{@version }tag.- Parameters:
text- the content of the tag- Returns:
- a
VersionTreeobject
-
at
Sets the position to be recorded in subsequent tree nodes created by this factory. The position should be a character offset relative to the beginning of the source file orNOPOS.- Parameters:
pos- the position- Returns:
- this object, to facilitate method chaining
-
getFirstSentence
Gets the first sentence contained in a list of content. The determination of the first sentence is implementation specific, and may involve the use of a locale-specificBreakIteratorand other heuristics. The resulting list may share a common set of initial items with the input list.- Parameters:
list- the list- Returns:
- a list containing the first sentence of the list
-