langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 35426 374342e56a56
child 44810 448516ac7b09
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
     2
 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import com.sun.javadoc.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * The interface for a custom tag used by Doclets. A custom
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    32
 * tag must implement this interface.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    33
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    34
 * <p style="font-style: italic; font-size:larger">
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    35
 * <b>Note:</b> This interface has been superseded by one
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    36
 * in the new package {@code jdk.javadoc.doclet.taglet}.
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    37
 * </p>
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    38
 *
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 25874
diff changeset
    39
 * To be loaded and used by
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * doclets at run-time, the taglet must have a static method called
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * <code>register</code> that accepts a {@link java.util.Map} as an
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * argument with the following signature:
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * <pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 *   public void register(Map map)
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * </pre>
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * This method should add an instance of the custom taglet to the map
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * with the name of the taglet as the key.  If overriding a taglet,
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * to avoid a name conflict, the overridden taglet must be deleted from
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * the map before an instance of the new taglet is added to the map.
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * It is recommended that the taglet throw an exception when it fails
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * to register itself.  The exception that it throws is up to the user.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * Here are two sample taglets: <br>
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * <ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 *  <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/ToDoTaglet.java">ToDoTaglet.java</a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 *         - Standalone taglet</li>
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 *  <li><a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/UnderlineTaglet.java">UnderlineTaglet.java</a>
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *         - Inline taglet</li>
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 * </ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * For more information on how to create your own Taglets, please see the
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * <a href="{@docRoot}/../../../../technotes/guides/javadoc/taglet/overview.html">Taglet Overview</a>.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 * @since 1.4
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 * @author Jamie Ho
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    67
 *
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    68
 * @deprecated
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    69
 *   This interface has been superseded by one in the new package {@code jdk.javadoc.doclet.taglet}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    71
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
public interface Taglet {
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * is used in field documentation.  Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     * is used in field documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    public abstract boolean inField();
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * is used in constructor documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     * is used in constructor documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    public abstract boolean inConstructor();
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * is used in method documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * is used in method documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    public abstract boolean inMethod();
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * is used in overview documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * is used in method documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    public abstract boolean inOverview();
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * is used in package documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * is used in package documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    public abstract boolean inPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * is used in type documentation (classes or
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * interfaces). Set to false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * is used in type documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    public abstract boolean inType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * is an inline tag. Return false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * is an inline tag and false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
    public abstract boolean isInlineTag();
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * Return the name of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * @return the name of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    public abstract String getName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * Given the <code>Tag</code> representation of this custom
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * tag, return its string representation, which is output
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * to the generated page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * @param tag the <code>Tag</code> representation of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * @return the string representation of this <code>Tag</code>.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    public abstract String toString(Tag tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     * Given an array of <code>Tag</code>s representing this custom
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * tag, return its string representation, which is output
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * to the generated page.  This method should
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * return null if this taglet represents an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * @param tags the array of <code>Tag</code>s representing of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * @return the string representation of this <code>Tag</code>.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    public abstract String toString(Tag[] tags);
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
}