public interface Taglet
standard doclet
. Custom taglets are used to handle custom tags in documentation comments; custom tags can be instantiated individually as either block tags, which appear at the end of a comment, or inline tags, which can appear within the main body of a documentation comment. Each implementation of a taglet must provide a public no-argument constructor to be used by doclets to instantiate the taglet. A doclet will interact with classes implementing this interface as follows:
init
method with an appropriate environment and doclet. getName
, getAllowedLocations
, and isInlineTag
, to determine the characteristics of the tags supported by the taglet. toString
method on the taglet object, giving it a list of tags and the element for which the tags are part of the element's documentation comment, from which the taglet can determine the string to be included in the documentation. The doclet will typically specify any requirements on the contents of the string that is returned. If a taglet object is created and used without the above protocol being followed, then the taglet's behavior is not defined by this interface specification.
Modifier and Type | Interface | Description |
---|---|---|
static enum |
Taglet.Location |
The kind of location in which a tag may be used. |
Modifier and Type | Method | Description |
---|---|---|
Set |
getAllowedLocations() |
Returns the set of supported locations for block tags. |
String |
getName() |
Returns the name of the tag supported by this taglet. |
default void |
init |
Initializes this taglet with the given doclet environment and doclet. |
default boolean |
isBlockTag() |
Indicates whether this taglet supports block tags. |
boolean |
isInlineTag() |
Indicates whether this taglet supports inline tags. |
String |
toString |
Returns the string representation of a series of instances of this tag to be included in the generated output. |
Set<Taglet.Location> getAllowedLocations()
boolean isInlineTag()
default boolean isBlockTag()
isInlineTag
.String getName()
default void init(DocletEnvironment env, Doclet doclet)
String toString(List<? extends DocTree> tags, Element element)
If this taglet supports inline
tags, it will be called once per instance of the inline tag, each time with a singleton list. If this taglet supports block
tags, it will be called once for each comment containing instances of block tags, with a list of all the instances of the block tag in that comment.
tags
- the list of instances of this tagelement
- the element to which the enclosing comment belongs
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.javadoc/jdk/javadoc/doclet/Taglet.html