Interface Taglet

public interface Taglet

The interface for a custom taglet supported by doclets such as the standard doclet. Custom taglets are used to handle custom tags in documentation comments.

A custom taglet must implement this interface, and must have a public default constructor (i.e. a public constructor with no parameters), by which, the doclet will instantiate and register the custom taglet.

Since:
9

Nested Classes

Modifier and Type Interface Description
static class  Taglet.Location

The kind of location in which a tag may be used.

Methods

Modifier and Type Method Description
Set<Taglet.Location> getAllowedLocations()

Returns the set of locations in which a tag may be used.

String getName()

Returns the name of the tag.

default void init​(DocletEnvironment env, Doclet doclet)

Initializes this taglet with the given doclet environment and doclet.

boolean isInlineTag()

Indicates whether this taglet is for inline tags or not.

String toString​(List<? extends DocTree> tags, Element element)

Returns the string representation of a series of instances of this tag to be included in the generated output.

Methods

getAllowedLocations

Set<Taglet.Location> getAllowedLocations()

Returns the set of locations in which a tag may be used.

Returns:
the set of locations in which a tag may be used

isInlineTag

boolean isInlineTag()

Indicates whether this taglet is for inline tags or not.

Returns:
true if this taglet is for an inline tag, and false otherwise

getName

String getName()

Returns the name of the tag.

Returns:
the name of this custom tag.

init

default void init(DocletEnvironment env,
                  Doclet doclet)

Initializes this taglet with the given doclet environment and doclet.

API Note:
The environment may be used to access utility classes for elements and types if needed.
Implementation Requirements:
This implementation does nothing.
Parameters:
env - the environment in which the doclet and taglet are running
doclet - the doclet that instantiated this taglet

toString

String toString(List<? extends DocTree> tags,
                Element element)

Returns the string representation of a series of instances of this tag to be included in the generated output. If this taglet is for an inline tag it will be called once per instance of the tag, each time with a singleton list. Otherwise, if this tag is a block tag, it will be called once per comment, with a list of all the instances of the tag in a comment.

Parameters:
tags - the list of instances of this tag
element - the element to which the enclosing comment belongs
Returns:
the string representation of the tags to be included in the generated output

© 1993, 2020, 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/11/docs/api/jdk.javadoc/jdk/javadoc/doclet/Taglet.html