KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > taglets > BaseTaglet


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: BaseTaglet.java 23 2006-02-22 14:10:17Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.taglets;
26
27 import com.sun.javadoc.Tag;
28 import com.sun.tools.doclets.Taglet;
29
30 /**
31  * This is a base taglet to document tests.
32  * Example: @toto the toto is magic.
33  * @author Eduardo Studzinski Estima de Castro
34  * @author Gisele Pinheiro Souza
35  */

36 public class BaseTaglet implements Taglet{
37
38     /**
39      * Tag literal.
40      */

41     private String JavaDoc strName = null;
42
43
44     /**
45      *
46      * @param name tag name. Example: tag = @toto, name = toto.
47      */

48     public BaseTaglet(final String JavaDoc name){
49         strName = name;
50     }
51
52     /**
53      * Will return false. The <code>@tagName</code> can't be used in field documentation.
54      * @return true since <code>@tagName</code>
55      * can be used in field documentation and false
56      * otherwise.
57      */

58     public boolean inField() {
59         return true;
60     }
61
62     /**
63      * Will return true. The <code>@tagName</code>
64      * can be used in constructor documentation.
65      * @return true since <code>@tagName</code>
66      * can be used in constructor documentation and false
67      * otherwise.
68      */

69     public boolean inConstructor() {
70         return true;
71     }
72
73     /**
74      * Will return true. The <code>@tagName</code> can be used in method documentation.
75      * @return true since <code>@tagName</code>
76      * can be used in method documentation and false
77      * otherwise.
78      */

79     public boolean inMethod() {
80         return true;
81     }
82
83     /**
84      * Will return true. The <code>@tagName</code> can be used in overview documentation.
85      * @return true since <code>@tagName</code>
86      * can be used in method documentation and false
87      * otherwise.
88      */

89     public boolean inOverview() {
90         return true;
91     }
92
93     /**
94      * Will return true. The <code>@tagName</code> can be used in package documentation.
95      * @return true since <code>@tagName</code>
96      * can be used in method documentation and false
97      * otherwise.
98      */

99     public boolean inPackage() {
100         return true;
101     }
102
103     /**
104      * Will return false. The <code>@tagName</code> can't be used in type documentation.
105      * @return true since <code>@tagName</code>
106      * can be used in type documentation and false
107      * otherwise.
108      */

109     public boolean inType() {
110         return true;
111     }
112
113     /**
114      * Will return false. The <code>@tagName</code>
115      * is not an inline tag.
116      * @return false since <code>@tagName</code>
117      * is not an inline tag.
118      */

119     public boolean isInlineTag() {
120         return false;
121     }
122
123
124
125     /**
126      * Return the name of this custom tag.
127      * @return name
128      */

129     public String JavaDoc getName() {
130         return strName;
131     }
132
133     /**
134      * Given the <code>Tag</code> representation of this custom
135      * tag,return its string representation.
136      * @param tag the <code>Tag</code> representation of this custom tag.
137      * @return output format of tag text
138      */

139     public String JavaDoc toString(final Tag tag) {
140         return tag.text();
141     }
142
143     /**
144      * Given an array of <code>Tag</code>s representing this custom
145      * tag, return its string representation.
146      * @param tags the array of <code>Tag</code>s representing of this custom tag.
147      * @return output format of tag texts
148      */

149     public String JavaDoc toString(final Tag[] tags) {
150         if (tags.length == 0) {
151             return null;
152         }
153         String JavaDoc result = "";
154         for (int i = 0; i < tags.length; i++) {
155             result += toString(tags[i]);
156         }
157         return result;
158     }
159 }
160
Popular Tags