langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Taglet.java
changeset 44388 4d0903f1f311
parent 44189 dd311cfb920b
child 44688 7ef050121b50
equal deleted inserted replaced
44387:8efb26290858 44388:4d0903f1f311
    25 
    25 
    26 package jdk.javadoc.doclet;
    26 package jdk.javadoc.doclet;
    27 
    27 
    28 import java.util.List;
    28 import java.util.List;
    29 import java.util.Set;
    29 import java.util.Set;
       
    30 
       
    31 import javax.lang.model.element.Element;
    30 
    32 
    31 import com.sun.source.doctree.DocTree;
    33 import com.sun.source.doctree.DocTree;
    32 
    34 
    33 /**
    35 /**
    34  * The interface for a custom taglet supported by doclets such as
    36  * The interface for a custom taglet supported by doclets such as
    63      * @return the name of this custom tag.
    65      * @return the name of this custom tag.
    64      */
    66      */
    65     String getName();
    67     String getName();
    66 
    68 
    67     /**
    69     /**
       
    70      * Initializes this taglet with the given doclet environment and doclet.
       
    71      *
       
    72      * @apiNote
       
    73      * The environment may be used to access utility classes for
       
    74      * {@link javax.lang.model.util.Elements elements} and
       
    75      * {@link javax.lang.model.util.Types types} if needed.
       
    76      *
       
    77      * @implSpec
       
    78      * This implementation does nothing.
       
    79      *
       
    80      * @param env the environment in which the doclet and taglet are running
       
    81      * @param doclet the doclet that instantiated this taglet
       
    82      */
       
    83     default void init(DocletEnvironment env, Doclet doclet) { }
       
    84 
       
    85     /**
    68      * Returns the string representation of a series of instances of
    86      * Returns the string representation of a series of instances of
    69      * this tag to be included in the generated output.
    87      * this tag to be included in the generated output.
    70      * If this taglet is for an {@link #isInlineTag inline} tag} it will
    88      * If this taglet is for an {@link #isInlineTag inline} tag} it will
    71      * be called once per instance of the tag, each time with a singleton list.
    89      * be called once per instance of the tag, each time with a singleton list.
    72      * Otherwise, if this tag is a block tag, it will be called once per
    90      * Otherwise, if this tag is a block tag, it will be called once per
    73      * comment, with a list of all the instances of the tag in the comment.
    91      * comment, with a list of all the instances of the tag in a comment.
    74      * @param tags the list of {@code DocTree} containing one or more
    92      * @param tags the list of instances of this tag
    75      *  instances of this tag
    93      * @param element the element to which the enclosing comment belongs
    76      * @return the string representation of the tags to be included in
    94      * @return the string representation of the tags to be included in
    77      *  the generated output
    95      *  the generated output
    78      */
    96      */
    79     String toString(List<? extends DocTree> tags);
    97     String toString(List<? extends DocTree> tags, Element element);
    80 
    98 
    81     /**
    99     /**
    82      * The kind of location in which a tag may be used.
   100      * The kind of location in which a tag may be used.
    83      */
   101      */
    84     public static enum Location {
   102     public static enum Location {