KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derbyBuild.javadoc.PurposeTaglet
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 package org.apache.derbyBuild.javadoc;
22
23 import com.sun.tools.doclets.Taglet;
24 import com.sun.javadoc.*;
25 import java.util.Map JavaDoc;
26
27 // Adapted from ToDoTaglet.java, Copyright 2002.
28

29 public class PurposeTaglet implements Taglet {
30
31     private String JavaDoc NAME = "purpose";
32     private String JavaDoc ROWNAME = "Purpose";
33
34     /**
35      * Returns the name of this taglet
36      * @return NAME
37      */

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

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

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

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

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

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

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

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

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

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

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