1 /* gnu.classpath.tools.taglets.GenericTaglet
2 Copyright (C) 2001 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 package gnu
.classpath
.tools
.taglets
;
25 import com
.sun
.tools
.doclets
.Taglet
;
27 import com
.sun
.javadoc
.Tag
;
30 * A taglet which can be configured at runtime.
32 * @author Julian Scheid (julian@sektor37.de)
34 public class GenericTaglet
implements Taglet
{
36 private String name
= "since";
37 private String header
= "Since:";
39 private boolean scopeOverview
;
40 private boolean scopePackage
;
41 private boolean scopeType
;
42 private boolean scopeConstructor
;
43 private boolean scopeMethod
;
44 private boolean scopeField
;
46 private boolean enabled
= true;
48 public GenericTaglet(String name
,
50 boolean scopeOverview
,
53 boolean scopeConstructor
,
59 this.scopeOverview
= scopeOverview
;
60 this.scopePackage
= scopePackage
;
61 this.scopeType
= scopeType
;
62 this.scopeConstructor
= scopeConstructor
;
63 this.scopeMethod
= scopeMethod
;
64 this.scopeField
= scopeField
;
67 public String
getName() {
71 public boolean inField() {
75 public boolean inConstructor() {
76 return scopeConstructor
;
79 public boolean inMethod() {
83 public boolean inOverview() {
87 public boolean inPackage() {
91 public boolean inType() {
95 public boolean isInlineTag() {
99 public void register(Map tagletMap
) {
100 tagletMap
.put(getName(), this);
103 public String
toString(Tag tag
) {
105 return toString(new Tag
[] { tag
});
112 public String
toString(Tag
[] tags
) {
113 if (!enabled
|| tags
.length
== 0) {
118 StringBuffer result
= new StringBuffer();
119 result
.append("<div class=\"classdoc-tag-section-header\">");
120 result
.append(header
);
121 result
.append("</div>");
122 result
.append("<dl class=\"classdoc-list\">");
123 for (int i
= 0; i
< tags
.length
; i
++) {
124 result
.append("<dt>");
125 result
.append(tags
[i
].text());
126 result
.append("</dt>");
128 result
.append("</dl>");
129 return result
.toString();
134 * Enables/disables this taglet.
136 public void setTagletEnabled(boolean enabled
)
138 this.enabled
= enabled
;