|
1 /* |
|
2 * Copyright 2003 Sun Microsystems, Inc. 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. Sun designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 * have any questions. |
|
24 */ |
|
25 |
|
26 package com.sun.tools.doclets.internal.toolkit.taglets; |
|
27 |
|
28 import com.sun.tools.doclets.internal.toolkit.util.*; |
|
29 import com.sun.javadoc.*; |
|
30 |
|
31 /** |
|
32 * An abstract class for that implements the {@link Taglet} interface. |
|
33 * |
|
34 * This code is not part of an API. |
|
35 * It is implementation that is subject to change. |
|
36 * Do not use it as an API |
|
37 * |
|
38 * @author Jamie Ho |
|
39 * @since 1.4 |
|
40 */ |
|
41 public abstract class BaseTaglet implements Taglet { |
|
42 |
|
43 protected String name = "Default"; |
|
44 |
|
45 /** |
|
46 * Return true if this <code>Taglet</code> |
|
47 * is used in constructor documentation. |
|
48 * @return true if this <code>Taglet</code> |
|
49 * is used in constructor documentation and false |
|
50 * otherwise. |
|
51 */ |
|
52 public boolean inConstructor() { |
|
53 return true; |
|
54 } |
|
55 |
|
56 /** |
|
57 * Return true if this <code>Taglet</code> |
|
58 * is used in field documentation. |
|
59 * @return true if this <code>Taglet</code> |
|
60 * is used in field documentation and false |
|
61 * otherwise. |
|
62 */ |
|
63 public boolean inField() { |
|
64 return true; |
|
65 } |
|
66 |
|
67 /** |
|
68 * Return true if this <code>Taglet</code> |
|
69 * is used in method documentation. |
|
70 * @return true if this <code>Taglet</code> |
|
71 * is used in method documentation and false |
|
72 * otherwise. |
|
73 */ |
|
74 public boolean inMethod() { |
|
75 return true; |
|
76 } |
|
77 |
|
78 /** |
|
79 * Return true if this <code>Taglet</code> |
|
80 * is used in overview documentation. |
|
81 * @return true if this <code>Taglet</code> |
|
82 * is used in method documentation and false |
|
83 * otherwise. |
|
84 */ |
|
85 public boolean inOverview() { |
|
86 return true; |
|
87 } |
|
88 |
|
89 /** |
|
90 * Return true if this <code>Taglet</code> |
|
91 * is used in package documentation. |
|
92 * @return true if this <code>Taglet</code> |
|
93 * is used in package documentation and false |
|
94 * otherwise. |
|
95 */ |
|
96 public boolean inPackage() { |
|
97 return true; |
|
98 } |
|
99 |
|
100 /** |
|
101 * Return true if this <code>Taglet</code> |
|
102 * is used in type documentation (classes or interfaces). |
|
103 * @return true if this <code>Taglet</code> |
|
104 * is used in type documentation and false |
|
105 * otherwise. |
|
106 */ |
|
107 public boolean inType() { |
|
108 return true; |
|
109 } |
|
110 |
|
111 /** |
|
112 * Return true if this <code>Taglet</code> |
|
113 * is an inline tag. |
|
114 * @return true if this <code>Taglet</code> |
|
115 * is an inline tag and false otherwise. |
|
116 */ |
|
117 public boolean isInlineTag() { |
|
118 return false; |
|
119 } |
|
120 |
|
121 /** |
|
122 * Return the name of this custom tag. |
|
123 * @return the name of this custom tag. |
|
124 */ |
|
125 public String getName() { |
|
126 return name; |
|
127 } |
|
128 |
|
129 /** |
|
130 * {@inheritDoc} |
|
131 * @throws IllegalArgumentException thrown when the method is not supported by the taglet. |
|
132 */ |
|
133 public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) { |
|
134 throw new IllegalArgumentException("Method not supported in taglet " + getName() + "."); |
|
135 } |
|
136 |
|
137 /** |
|
138 * {@inheritDoc} |
|
139 * @throws IllegalArgumentException thrown when the method is not supported by the taglet. |
|
140 */ |
|
141 public TagletOutput getTagletOutput(Doc holder, TagletWriter writer) { |
|
142 throw new IllegalArgumentException("Method not supported in taglet " + getName() + "."); |
|
143 } |
|
144 } |