langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/Taglet.java
author ksrini
Fri, 02 Jun 2017 13:38:43 -0700
changeset 45448 4b53bf8b530c
parent 44810 448516ac7b09
permissions -rw-r--r--
8181441: Fix minor typo/link in the old standard doclet API documentation Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
45448
4b53bf8b530c 8181441: Fix minor typo/link in the old standard doclet API documentation
ksrini
parents: 44810
diff changeset
     2
 * Copyright (c) 2001, 2017, 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">
45448
4b53bf8b530c 8181441: Fix minor typo/link in the old standard doclet API documentation
ksrini
parents: 44810
diff changeset
    35
 * <b>Note:</b> This interface has been superseded by its replacement,
4b53bf8b530c 8181441: Fix minor typo/link in the old standard doclet API documentation
ksrini
parents: 44810
diff changeset
    36
 * {@link jdk.javadoc.doclet.Taglet}.
35426
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>
44810
448516ac7b09 8157763: update links to technotes in javadoc API
jjg
parents: 38617
diff changeset
    56
 *  <li><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/taglet/ToDoTaglet.java">ToDoTaglet.java</a>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 *         - Standalone taglet</li>
44810
448516ac7b09 8157763: update links to technotes in javadoc API
jjg
parents: 38617
diff changeset
    58
 *  <li><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/taglet/UnderlineTaglet.java">UnderlineTaglet.java</a>
10
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
44810
448516ac7b09 8157763: update links to technotes in javadoc API
jjg
parents: 38617
diff changeset
    63
 * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/taglet/overview.html">Taglet Overview</a>.
10
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
45448
4b53bf8b530c 8181441: Fix minor typo/link in the old standard doclet API documentation
ksrini
parents: 44810
diff changeset
    69
 * This interface has been superseded by its replacement,
4b53bf8b530c 8181441: Fix minor typo/link in the old standard doclet API documentation
ksrini
parents: 44810
diff changeset
    70
 * {@link jdk.javadoc.doclet.Taglet}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 35426
diff changeset
    72
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
public interface Taglet {
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * is used in field documentation.  Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * is used in field documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public abstract boolean inField();
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * is used in constructor documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * is used in constructor documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public abstract boolean inConstructor();
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * is used in method documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     * is used in method documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    public abstract boolean inMethod();
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * is used in overview documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * is used in method documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    public abstract boolean inOverview();
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * is used in package documentation. Set to
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     * is used in package documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    public abstract boolean inPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * is used in type documentation (classes or
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * interfaces). Set to false for inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * is used in type documentation and false
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    public abstract boolean inType();
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * Return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * is an inline tag. Return false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * @return true if this <code>Taglet</code>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * is an inline tag and false otherwise.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public abstract boolean isInlineTag();
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * Return the name of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * @return the name of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    public abstract String getName();
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * Given the <code>Tag</code> representation of this custom
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * tag, return its string representation, which is output
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * to the generated page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * @param tag the <code>Tag</code> representation of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * @return the string representation of this <code>Tag</code>.
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
    public abstract String toString(Tag tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * Given an array of <code>Tag</code>s representing this custom
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * tag, return its string representation, which is output
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * to the generated page.  This method should
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * return null if this taglet represents an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * @param tags the array of <code>Tag</code>s representing of this custom tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     * @return the string representation of this <code>Tag</code>.
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
    public abstract String toString(Tag[] tags);
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
}