APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.javadoc.internal.doclets.formats.html.taglets

public Class TagletWriter

extends Object
Class Inheritance
Imports
java.util.EnumSet, .List, .Map, .Objects, .Optional, .Set, java.util.function.Predicate, javax.lang.model.element.Element, .ElementKind, .ExecutableElement, .ModuleElement, .PackageElement, .TypeElement, .VariableElement, javax.lang.model.util.SimpleElementVisitor14, com.sun.source.doctree.DocTree, .InlineTagTree, jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration, .HtmlDocletWriter, .HtmlIds, .HtmlOptions, jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles, jdk.javadoc.internal.doclets.formats.html.taglets.Taglet.UnsupportedTagletOperationException, jdk.javadoc.internal.doclets.toolkit.DocletElement, .Resources, jdk.javadoc.internal.doclets.toolkit.util.CommentHelper, .DocLink, .IndexItem, .Utils, jdk.javadoc.internal.html.Content, .ContentBuilder, .HtmlId, .HtmlTree, .Text

Context and utility methods for taglet classes.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TagletWriter.Context

A class that provides the information about the enclosing context for a series of DocTree nodes.

Field Summary

Modifier and TypeField and Description
public final HtmlConfiguration
public final TagletWriter.Context
context

The context in which to generate the output for a series of DocTree nodes.

public final HtmlDocletWriter
public final HtmlOptions
public final Resources
private static final int
public final Utils

Constructor Summary

AccessConstructor and Description
public
TagletWriter(HtmlDocletWriter
the HtmlDocletWriter for the page
htmlWriter
,
boolean
true if this taglet writer is being used for a "first sentence" summary
isFirstSentence
)

Creates a taglet writer.

public
TagletWriter(HtmlDocletWriter
the HtmlDocletWriter for the page
htmlWriter
,
boolean
true if this taglet writer is being used for a "first sentence" summary, and false otherwise
isFirstSentence
,
boolean
true if this taglet writer is being used for the content of a {@summary ...} tag, and false otherwise
inSummary
)

Creates a taglet writer.

public
TagletWriter(HtmlDocletWriter
the HtmlDocletWriter for the page
htmlWriter
,
TagletWriter.Context
the enclosing context for any tags
context
)

Creates a taglet writer.

Method Summary

Modifier and TypeMethod and Description
public Content

Returns:

the generated content
commentTagsToOutput
(DocTree
the tree that holds the documentation
holderTree
,
List<? extends DocTree>
list of DocTree nodes containing text and inline tags (often alternating) present in the text of interest for this doc
trees
)

Converts inline tags and text to content, expanding the inline tags along the way.

public Content

Returns:

the generated content
commentTagsToOutput
(Element
The element that owns the documentation
element
,
List<? extends DocTree>
list of DocTree nodes containing text and inline tags (often alternating) present in the text of interest for this doc
trees
)

Converts inline tags and text to content, expanding the inline tags along the way.

public Content

Returns:

the generated content
commentTagsToOutput
(Element
the element where comment resides
element
,
DocTree
the tag that holds the documentation
holder
,
List<? extends DocTree>
array of text tags and inline tags (often alternating) present in the text of interest for this doc
trees
,
boolean
true if this is the first sentence
isFirstSentence
)

Converts inline tags and text to content, expanding the inline tags along the way.

public Content
createAnchorAndSearchIndex(Element element, String tagText, String desc, DocTree tree)

pack-priv Content
createAnchorAndSearchIndex(Element element, String tagText, Content tagContent, String desc, DocTree tree)

public Content

Returns:

the content
getBlockTagOutput
(TagletManager
the manager that manages the taglets
tagletManager
,
Element
the element that we are to write tags for
element
,
List<Taglet>
the taglets for the tags to write
taglets
)

Returns the content generated from the block tags for a given element.

public TagletWriter.Context
public TypeElement

Returns:

the type element documented by the current HtmlDocletWriter (may be null)
getCurrentTypeElement
()

Returns the type element documented by the current HtmlDocletWriter (may be null).

public String
private String
public Content

Returns:

the content, or null
getInlineTagOutput
(Element
the element associated with the doc comment
holder
,
InlineTagTree
the inline tag to be documented
inlineTag
)

Returns the content generated from an inline tag in the doc comment for a given element, or null if the tag is not supported or does not return any output.

public Content

Returns:

an instance of an output object
getOutputInstance
()

Returns an instance of an output object.

public Content

Returns:

the output
invalidTagOutput
(String
the single-line summary message
summary
,
Optional<String>
the optional detail message which may contain preformatted text
detail
)

Returns the output for an invalid tag.

private boolean
private boolean
pack-priv Content
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configurationback to summary
public final HtmlConfiguration configuration
contextback to summary
public final TagletWriter.Context context

The context in which to generate the output for a series of DocTree nodes.

htmlWriterback to summary
public final HtmlDocletWriter htmlWriter
optionsback to summary
public final HtmlOptions options
resourcesback to summary
public final Resources resources
TAG_LIST_ITEM_MAX_INLINE_LENGTHback to summary
private static final int TAG_LIST_ITEM_MAX_INLINE_LENGTH
utilsback to summary
public final Utils utils

Constructor Detail

TagletWriterback to summary
public TagletWriter(HtmlDocletWriter htmlWriter, boolean isFirstSentence)

Creates a taglet writer.

Parameters
htmlWriter:HtmlDocletWriter

the HtmlDocletWriter for the page

isFirstSentence:boolean

true if this taglet writer is being used for a "first sentence" summary

TagletWriterback to summary
public TagletWriter(HtmlDocletWriter htmlWriter, boolean isFirstSentence, boolean inSummary)

Creates a taglet writer.

Parameters
htmlWriter:HtmlDocletWriter

the HtmlDocletWriter for the page

isFirstSentence:boolean

true if this taglet writer is being used for a "first sentence" summary, and false otherwise

inSummary:boolean

true if this taglet writer is being used for the content of a {@summary ...} tag, and false otherwise

TagletWriterback to summary
public TagletWriter(HtmlDocletWriter htmlWriter, TagletWriter.Context context)

Creates a taglet writer.

Parameters
htmlWriter:HtmlDocletWriter

the HtmlDocletWriter for the page

context:TagletWriter.Context

the enclosing context for any tags

Method Detail

commentTagsToOutputback to summary
public Content commentTagsToOutput(DocTree holderTree, List<? extends DocTree> trees)

Converts inline tags and text to content, expanding the inline tags along the way. Called wherever text can contain an inline tag, such as in comments or in free-form text arguments to block tags.

Parameters
holderTree:DocTree

the tree that holds the documentation

trees:List<? extends DocTree>

list of DocTree nodes containing text and inline tags (often alternating) present in the text of interest for this doc

Returns:Content

the generated content

commentTagsToOutputback to summary
public Content commentTagsToOutput(Element element, List<? extends DocTree> trees)

Converts inline tags and text to content, expanding the inline tags along the way. Called wherever text can contain an inline tag, such as in comments or in free-form text arguments to block tags.

Parameters
element:Element

The element that owns the documentation

trees:List<? extends DocTree>

list of DocTree nodes containing text and inline tags (often alternating) present in the text of interest for this doc

Returns:Content

the generated content

commentTagsToOutputback to summary
public Content commentTagsToOutput(Element element, DocTree holder, List<? extends DocTree> trees, boolean isFirstSentence)

Converts inline tags and text to content, expanding the inline tags along the way. Called wherever text can contain an inline tag, such as in comments or in free-form text arguments to non-inline tags.

Parameters
element:Element

the element where comment resides

holder:DocTree

the tag that holds the documentation

trees:List<? extends DocTree>

array of text tags and inline tags (often alternating) present in the text of interest for this doc

isFirstSentence:boolean

true if this is the first sentence

Returns:Content

the generated content

createAnchorAndSearchIndexback to summary
public Content createAnchorAndSearchIndex(Element element, String tagText, String desc, DocTree tree)
createAnchorAndSearchIndexback to summary
pack-priv Content createAnchorAndSearchIndex(Element element, String tagText, Content tagContent, String desc, DocTree tree)
getBlockTagOutputback to summary
public Content getBlockTagOutput(TagletManager tagletManager, Element element, List<Taglet> taglets)

Returns the content generated from the block tags for a given element. The content is generated according to the order of the list of taglets. The result is a possibly-empty list of the output generated by each of the given taglets for all of the tags they individually support.

Parameters
tagletManager:TagletManager

the manager that manages the taglets

element:Element

the element that we are to write tags for

taglets:List<Taglet>

the taglets for the tags to write

Returns:Content

the content

getContextback to summary
public TagletWriter.Context getContext()
getCurrentTypeElementback to summary
public TypeElement getCurrentTypeElement()

Returns the type element documented by the current HtmlDocletWriter (may be null).

Returns:TypeElement

the type element documented by the current HtmlDocletWriter (may be null)

getHolderNameback to summary
public String getHolderName(Element element)
getHolderNameback to summary
private String getHolderName(DocletElement de)
getInlineTagOutputback to summary
public Content getInlineTagOutput(Element holder, InlineTagTree inlineTag)

Returns the content generated from an inline tag in the doc comment for a given element, or null if the tag is not supported or does not return any output.

Parameters
holder:Element

the element associated with the doc comment

inlineTag:InlineTagTree

the inline tag to be documented

Returns:Content

the content, or null

getOutputInstanceback to summary
public Content getOutputInstance()

Returns an instance of an output object.

Returns:Content

an instance of an output object

invalidTagOutputback to summary
public Content invalidTagOutput(String summary, Optional<String> detail)

Returns the output for an invalid tag. The returned content uses special styling to highlight the problem. Depending on the presence of the detail string the method returns a plain text span or an expandable component.

Parameters
summary:String

the single-line summary message

detail:Optional<String>

the optional detail message which may contain preformatted text

Returns:Content

the output

isDifferentTypeElementback to summary
private boolean isDifferentTypeElement(Element element)
isLongOrHasCommaback to summary
private boolean isLongOrHasComma(Content c)
tagListback to summary
pack-priv Content tagList(List<Content> items)
jdk.javadoc.internal.doclets.formats.html.taglets back to summary

public Class TagletWriter.Context

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.javadoc.internal.doclets.formats.html.taglets.TagletWriter.Context

A class that provides the information about the enclosing context for a series of DocTree nodes. This context may be used to determine the content that should be generated from the tree nodes.

Field Summary

Modifier and TypeField and Description
public final boolean
inSummary

Whether the trees are appearing in the "summary" section of the page for a declaration.

public final Set<DocTree.Kind>
inTags

The set of enclosing kinds of tags.

public final boolean
isFirstSentence

Whether the trees are appearing in a context of just the first sentence, such as in the summary table of the enclosing element.

Constructor Summary

AccessConstructor and Description
public
Context(boolean
true if the trees are appearing in a context of just the first sentence and false otherwise
isFirstSentence
,
boolean
true if the trees are appearing in the "summary" section of the page for a declaration and false otherwise
inSummary
)

Creates an outermost context, with no enclosing tags.

private
Context(boolean isFirstSentence, boolean inSummary, Set<DocTree.Kind> inTags)

Method Summary

Modifier and TypeMethod and Description
public TagletWriter.Context

Returns:

the new Context
within
(DocTree
the enclosing tree
tree
)

Creates a new Context that includes an extra tag kind in the set of enclosing kinds of tags.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inSummaryback to summary
public final boolean inSummary

Whether the trees are appearing in the "summary" section of the page for a declaration.

inTagsback to summary
public final Set<DocTree.Kind> inTags

The set of enclosing kinds of tags.

isFirstSentenceback to summary
public final boolean isFirstSentence

Whether the trees are appearing in a context of just the first sentence, such as in the summary table of the enclosing element.

Constructor Detail

Contextback to summary
public Context(boolean isFirstSentence, boolean inSummary)

Creates an outermost context, with no enclosing tags.

Parameters
isFirstSentence:boolean

true if the trees are appearing in a context of just the first sentence and false otherwise

inSummary:boolean

true if the trees are appearing in the "summary" section of the page for a declaration and false otherwise

Contextback to summary
private Context(boolean isFirstSentence, boolean inSummary, Set<DocTree.Kind> inTags)

Method Detail

withinback to summary
public TagletWriter.Context within(DocTree tree)

Creates a new Context that includes an extra tag kind in the set of enclosing kinds of tags.

Parameters
tree:DocTree

the enclosing tree

Returns:TagletWriter.Context

the new Context