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