KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyBuild > javadoc > UpgradeTaglet


1 /*
2
3    Derby - Class org.apache.derbyBuild.javadoc.UpgradeTaglet
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyBuild.javadoc;
23
24 import com.sun.tools.doclets.Taglet;
25 import com.sun.javadoc.*;
26 import java.util.Map JavaDoc;
27
28 public class UpgradeTaglet implements Taglet {
29     private String JavaDoc NAME = "upgrade";
30     private String JavaDoc ROWNAME = "Upgrade";
31
32     /**
33      * Returns the name of this taglet
34      * @return NAME
35      */

36     public String JavaDoc getName() {
37         return NAME;
38     }
39
40     /**
41      * upgrade not expected to be used in field documentation.
42      * @return false
43      */

44     public boolean inField() {
45         return false;
46     }
47
48     /**
49      * upgrade not expected to be used in constructor documentation.
50      * @return false
51      */

52     public boolean inConstructor() {
53         return false;
54     }
55
56     /**
57      * upgrade not expected to be used in method documentation.
58      * @return false
59      */

60     public boolean inMethod() {
61         return false;
62     }
63
64     /**
65      * upgrade can be used in overview documentation.
66      * @return true
67      */

68     public boolean inOverview() {
69         return true;
70     }
71
72     /**
73      * upgrade can be used in package documentation.
74      * @return true
75      */

76     public boolean inPackage() {
77         return true;
78     }
79
80     /**
81      * upgrade can be used in type documentation.
82      * @return true
83      */

84     public boolean inType() {
85         return true;
86     }
87
88     /**
89      * upgrade is not an inline tag.
90      * @return false
91      */

92     public boolean isInlineTag() {
93         return false;
94     }
95
96     /**
97      * Register this Taglet.
98      * @param tagletMap
99      */

100     public static void register(Map JavaDoc tagletMap) {
101        UpgradeTaglet tag = new UpgradeTaglet();
102        Taglet t = (Taglet) tagletMap.get(tag.getName());
103        if (t != null) {
104            tagletMap.remove(tag.getName());
105        }
106        tagletMap.put(tag.getName(), tag);
107     }
108
109     /**
110      * Embed the contents of the upgrade tag as a row
111      * in the disk format table.
112      * @param tag The tag to embed to the disk format the table.
113      */

114     public String JavaDoc toString(Tag tag) {
115         return "<tr><td>" + ROWNAME + "</td>"
116                + "<td>" + tag.text() + "</td></tr>\n";
117     }
118
119     /**
120      * Embed multiple upgrade tags as cells in the disk format table.
121      * @param tags An array of tags to add to the disk format table.
122      */

123     public String JavaDoc toString(Tag[] tags) {
124         if (tags.length == 0) {
125             return null;
126         }
127         String JavaDoc result = "<tr><td>" + ROWNAME + "</td><td>";
128         for (int i = 0; i < tags.length; i++) {
129             if (i > 0) {
130                 result += "";
131             }
132             result += tags[i].text() + "</td></tr>";
133         }
134         return result + "\n";
135     }
136 }
137
138
Popular Tags