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

public Class TagletManager

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .PrintStream, java.util.ArrayList, .EnumMap, .EnumSet, .HashSet, .LinkedHashMap, .LinkedHashSet, .List, .Map, .ServiceLoader, .Set, .TreeMap, javax.lang.model.element.Element, .ExecutableElement, .ModuleElement, .PackageElement, .TypeElement, .VariableElement, javax.lang.model.util.SimpleElementVisitor14, javax.tools.JavaFileManager, .StandardJavaFileManager, com.sun.source.doctree.BlockTagTree, .DocTree, .InlineTagTree, jdk.javadoc.doclet.Doclet, .DocletEnvironment, .Taglet.Location, jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration, .HtmlOptions, jdk.javadoc.internal.doclets.toolkit.DocletElement, .Messages, .Resources, jdk.javadoc.internal.doclets.toolkit.util.CommentHelper, .Utils, jdk.javadoc.internal.doclint.DocLint

Manages the Taglets used by the standard doclet.

Field Summary

Modifier and TypeField and Description
private final LinkedHashMap<String, Taglet>
allTaglets

All taglets, keyed either by their name, or by an alias.

private Map<Taglet.Location, List<Taglet>>
blockTagletsByLocation

Block (non-inline) taglets, grouped by location.

private final HtmlConfiguration
private final DocletEnvironment
private final Doclet
private Map<String, Taglet>
inlineTags

The taglets that can appear inline in descriptive text.

private final boolean
javafx

True if we want to use JavaFX-related tags (@defaultValue, @treatAsPrivate).

private final Messages
private final boolean
nosince

True if we do not want to use @since tags.

private final Set<String>
overriddenStandardTags

Keep track of overridden standard tags.

private final Set<String>
potentiallyConflictingTags

Keep track of the tags that may conflict with standard tags in the future (any custom tag without a period in its name).

private final Resources
private List<Taglet>
serializedFormTags

The taglets that can appear in the serialized form.

private final boolean
showauthor

True if we want to use @author tags.

private final boolean
showTaglets

Show the taglets table when it has been initialized.

private final boolean
showversion

True if we want to use @version tags.

private final Set<String>
standardTags

Keep track of standard tags.

private final String
private final Set<String>
unseenCustomTags

The set of unseen custom tags.

private final Utils

Constructor Summary

AccessConstructor and Description
public
TagletManager(HtmlConfiguration
the configuration for this taglet manager
config
)

Constructs a new TagletManager.

Method Summary

Modifier and TypeMethod and Description
public void
addCustomTag(String
the name of the class representing the custom tag
classname
,
JavaFileManager
the file manager to load classes and resources
fileManager
)

Adds a new Taglet.

public void
addNewSimpleCustomTag(String
the name of this tag
tagName
,
String
the header to output
header
,
String
the possible locations that this tag can appear in
locations
)

Adds a new SimpleTaglet.

private void
private void
private void
checkTagName(String name)

Given a tag name, add it to the set of tags it belongs to.

public void
checkTags(Element
the tags holder
element
,
Iterable<? extends DocTree>
the trees containing the comments
trees
)

Given a series of DocTrees, check for misuse and spelling mistakes.

private String
format(boolean b, String s)

public Set<String>
public List<Taglet>

Returns:

the array of Taglets that can appear in the given element
getBlockTaglets
(Element
the element to get custom tags for
e
)

Returns the custom tags for a given element.

pack-priv Map<String, Taglet>

Returns:

the taglets that can appear inline
getInlineTaglets
()

Returns the taglets that can appear inline, in descriptive text.

public List<Taglet>

Returns:

the taglet that can appear in the serialized form
getSerializedFormTaglets
()

Returns the taglets that can appear in the serialized form.

pack-priv Taglet

Returns:

the corresponding taglet or null if the tag is unknown
getTaglet
(String
the name of the taglet to retrieve
name
)

Given the name of a tag, return the corresponding taglet.

public Taglet
private void
initJavaFXTaglets()

Initialize JavaFX-related tags.

private void
initStandardTaglets()

Initialize standard Javadoc tags for ordering purposes.

public void
initTagletPath(JavaFileManager
the file manager to load classes and resources
fileManager
)

Initializes the location TAGLET_PATH which is used to locate the custom taglets.

private void
initTaglets()

Initialize the tag collections.

public boolean
public void
loadTaglets(JavaFileManager
the file manager to load the taglets
fileManager
)

Loads taglets from a taglet path using the service loader.

public void
printReport()

Print a list of Taglets that might conflict with standard tags in the future and a list of standard tags that have been overridden.

private void
printReportHelper(String noticeKey, Set<String> names)

private void
printTagMisuseWarn(CommentHelper ch, Taglet
the taglet representing the misused tag
taglet
,
DocTree
the misused tag
tag
,
String
the type of documentation that the misused tag was found in
holderType
)

Given the taglet, the tag and the type of documentation that the tag was found in, print a tag misuse warning.

private void
registerTaglet(Taglet
the Taglet instance
instance
)

Registers the Taglet.

pack-priv void
seenTag(String
the name of the tag
name
)

Reports that a tag was seen in a doc comment.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allTagletsback to summary
private final LinkedHashMap<String, Taglet> allTaglets

All taglets, keyed either by their name, or by an alias. In general, taglets do not provide aliases; the one instance that does is ThrowsTaglet, which handles both @throws tags and @exception tags.

blockTagletsByLocationback to summary
private Map<Taglet.Location, List<Taglet>> blockTagletsByLocation

Block (non-inline) taglets, grouped by location.

configback to summary
private final HtmlConfiguration config
docEnvback to summary
private final DocletEnvironment docEnv
docletback to summary
private final Doclet doclet
inlineTagsback to summary
private Map<String, Taglet> inlineTags

The taglets that can appear inline in descriptive text.

javafxback to summary
private final boolean javafx

True if we want to use JavaFX-related tags (@defaultValue, @treatAsPrivate).

messagesback to summary
private final Messages messages
nosinceback to summary
private final boolean nosince

True if we do not want to use @since tags.

overriddenStandardTagsback to summary
private final Set<String> overriddenStandardTags

Keep track of overridden standard tags.

potentiallyConflictingTagsback to summary
private final Set<String> potentiallyConflictingTags

Keep track of the tags that may conflict with standard tags in the future (any custom tag without a period in its name).

resourcesback to summary
private final Resources resources
serializedFormTagsback to summary
private List<Taglet> serializedFormTags

The taglets that can appear in the serialized form.

showauthorback to summary
private final boolean showauthor

True if we want to use @author tags.

showTagletsback to summary
private final boolean showTaglets

Show the taglets table when it has been initialized.

showversionback to summary
private final boolean showversion

True if we want to use @version tags.

standardTagsback to summary
private final Set<String> standardTags

Keep track of standard tags.

tagletPathback to summary
private final String tagletPath
unseenCustomTagsback to summary
private final Set<String> unseenCustomTags

The set of unseen custom tags.

utilsback to summary
private final Utils utils

Constructor Detail

TagletManagerback to summary
public TagletManager(HtmlConfiguration config)

Constructs a new TagletManager.

Parameters
config:HtmlConfiguration

the configuration for this taglet manager

Method Detail

addCustomTagback to summary
public void addCustomTag(String classname, JavaFileManager fileManager)

Adds a new Taglet. Prints a message to indicate whether or not the Taglet was registered properly.

Parameters
classname:String

the name of the class representing the custom tag

fileManager:JavaFileManager

the file manager to load classes and resources

addNewSimpleCustomTagback to summary
public void addNewSimpleCustomTag(String tagName, String header, String locations)

Adds a new SimpleTaglet. If this tag already exists and the header passed as an argument is null, move tag to the back of the list. If this tag already exists and the header passed as an argument is not null, overwrite previous tag with the new one. Otherwise, add a new SimpleTaglet to the list.

Parameters
tagName:String

the name of this tag

header:String

the header to output

locations:String

the possible locations that this tag can appear in

addStandardTagletback to summary
private void addStandardTaglet(Taglet taglet)
addStandardTagletback to summary
private void addStandardTaglet(Taglet taglet, DocTree.Kind alias)
checkTagNameback to summary
private void checkTagName(String name)

Given a tag name, add it to the set of tags it belongs to.

checkTagsback to summary
public void checkTags(Element element, Iterable<? extends DocTree> trees)

Given a series of DocTrees, check for misuse and spelling mistakes.

Parameters
element:Element

the tags holder

trees:Iterable<? extends DocTree>

the trees containing the comments

formatback to summary
private String format(boolean b, String s)
getAllTagletNamesback to summary
public Set<String> getAllTagletNames()
getBlockTagletsback to summary
public List<Taglet> getBlockTaglets(Element e)

Returns the custom tags for a given element.

Parameters
e:Element

the element to get custom tags for

Returns:List<Taglet>

the array of Taglets that can appear in the given element

Annotations
@SuppressWarnings:fallthrough
getInlineTagletsback to summary
pack-priv Map<String, Taglet> getInlineTaglets()

Returns the taglets that can appear inline, in descriptive text.

Returns:Map<String, Taglet>

the taglets that can appear inline

getSerializedFormTagletsback to summary
public List<Taglet> getSerializedFormTaglets()

Returns the taglets that can appear in the serialized form.

Returns:List<Taglet>

the taglet that can appear in the serialized form

getTagletback to summary
pack-priv Taglet getTaglet(String name)

Given the name of a tag, return the corresponding taglet.

Parameters
name:String

the name of the taglet to retrieve

Returns:Taglet

the corresponding taglet or null if the tag is unknown

getTagletback to summary
public Taglet getTaglet(DocTree.Kind kind)
initJavaFXTagletsback to summary
private void initJavaFXTaglets()

Initialize JavaFX-related tags.

initStandardTagletsback to summary
private void initStandardTaglets()

Initialize standard Javadoc tags for ordering purposes.

initTagletPathback to summary
public void initTagletPath(JavaFileManager fileManager) throws IOException

Initializes the location TAGLET_PATH which is used to locate the custom taglets.

Parameters
fileManager:JavaFileManager

the file manager to load classes and resources

Exceptions
IOException:
if an error occurs while setting the location
initTagletsback to summary
private void initTaglets()

Initialize the tag collections.

isKnownCustomTagback to summary
public boolean isKnownCustomTag(String tagName)
loadTagletsback to summary
public void loadTaglets(JavaFileManager fileManager) throws IOException

Loads taglets from a taglet path using the service loader.

Parameters
fileManager:JavaFileManager

the file manager to load the taglets

Exceptions
IOException:
if an error occurs while getting the service loader
printReportback to summary
public void printReport()

Print a list of Taglets that might conflict with standard tags in the future and a list of standard tags that have been overridden.

printReportHelperback to summary
private void printReportHelper(String noticeKey, Set<String> names)
printTagMisuseWarnback to summary
private void printTagMisuseWarn(CommentHelper ch, Taglet taglet, DocTree tag, String holderType)

Given the taglet, the tag and the type of documentation that the tag was found in, print a tag misuse warning.

Parameters
taglet:Taglet

the taglet representing the misused tag

tag:DocTree

the misused tag

holderType:String

the type of documentation that the misused tag was found in

registerTagletback to summary
private void registerTaglet(Taglet instance)

Registers the Taglet. Prints a message if the Taglet got registered properly.

Parameters
instance:Taglet

the Taglet instance

seenTagback to summary
pack-priv void seenTag(String name)

Reports that a tag was seen in a doc comment. It is removed from the list of custom tags that have not yet been seen.

Parameters
name:String

the name of the tag

showTagletsback to summary
private void showTaglets(PrintStream out)