10
|
1 |
/*
|
|
2 |
* Copyright 2003-2004 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.formats.html;
|
|
27 |
|
|
28 |
import com.sun.tools.doclets.internal.toolkit.*;
|
|
29 |
import com.sun.tools.doclets.internal.toolkit.taglets.*;
|
|
30 |
import com.sun.javadoc.*;
|
|
31 |
|
|
32 |
import java.io.*;
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Writes annotation type required member documentation in HTML format.
|
|
36 |
*
|
|
37 |
* @author Jamie Ho
|
|
38 |
*/
|
|
39 |
public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
|
|
40 |
implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Construct a new AnnotationTypeRequiredMemberWriterImpl.
|
|
44 |
*
|
|
45 |
* @param writer the writer that will write the output.
|
|
46 |
* @param annotationType the AnnotationType that holds this member.
|
|
47 |
*/
|
|
48 |
public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
|
|
49 |
AnnotationTypeDoc annotationType) {
|
|
50 |
super(writer, annotationType);
|
|
51 |
}
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Write the annotation type member summary header for the given class.
|
|
55 |
*
|
|
56 |
* @param classDoc the class the summary belongs to.
|
|
57 |
*/
|
|
58 |
public void writeMemberSummaryHeader(ClassDoc classDoc) {
|
|
59 |
writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->");
|
|
60 |
writer.println();
|
|
61 |
writer.printSummaryHeader(this, classDoc);
|
|
62 |
}
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Write the annotation type member summary footer for the given class.
|
|
66 |
*
|
|
67 |
* @param classDoc the class the summary belongs to.
|
|
68 |
*/
|
|
69 |
public void writeMemberSummaryFooter(ClassDoc classDoc) {
|
|
70 |
writer.printSummaryFooter(this, classDoc);
|
|
71 |
}
|
|
72 |
|
|
73 |
/**
|
|
74 |
* {@inheritDoc}
|
|
75 |
*/
|
|
76 |
public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
|
|
77 |
//Not appliable.
|
|
78 |
}
|
|
79 |
|
|
80 |
/**
|
|
81 |
* {@inheritDoc}
|
|
82 |
*/
|
|
83 |
public void writeInheritedMemberSummary(ClassDoc classDoc,
|
|
84 |
ProgramElementDoc member, boolean isFirst, boolean isLast) {
|
|
85 |
//Not appliable.
|
|
86 |
}
|
|
87 |
|
|
88 |
/**
|
|
89 |
* {@inheritDoc}
|
|
90 |
*/
|
|
91 |
public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
|
|
92 |
//Not appliable.
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
* {@inheritDoc}
|
|
97 |
*/
|
|
98 |
public void writeHeader(ClassDoc classDoc, String header) {
|
|
99 |
writer.println();
|
|
100 |
writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
|
|
101 |
writer.println();
|
|
102 |
writer.anchor("annotation_type_element_detail");
|
|
103 |
writer.printTableHeadingBackground(header);
|
|
104 |
writer.println();
|
|
105 |
}
|
|
106 |
|
|
107 |
/**
|
|
108 |
* {@inheritDoc}
|
|
109 |
*/
|
|
110 |
public void writeMemberHeader(MemberDoc member, boolean isFirst) {
|
|
111 |
if (! isFirst) {
|
|
112 |
writer.printMemberHeader();
|
|
113 |
writer.println("");
|
|
114 |
}
|
|
115 |
writer.anchor(member.name() + ((ExecutableMemberDoc) member).signature());
|
|
116 |
writer.h3();
|
|
117 |
writer.print(member.name());
|
|
118 |
writer.h3End();
|
|
119 |
}
|
|
120 |
|
|
121 |
/**
|
|
122 |
* {@inheritDoc}
|
|
123 |
*/
|
|
124 |
public void writeSignature(MemberDoc member) {
|
|
125 |
writer.pre();
|
|
126 |
writer.writeAnnotationInfo(member);
|
|
127 |
printModifiers(member);
|
|
128 |
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
|
|
129 |
getType(member)));
|
|
130 |
print(' ');
|
|
131 |
if (configuration().linksource) {
|
|
132 |
writer.printSrcLink(member, member.name());
|
|
133 |
} else {
|
|
134 |
bold(member.name());
|
|
135 |
}
|
|
136 |
writer.preEnd();
|
|
137 |
writer.dl();
|
|
138 |
}
|
|
139 |
|
|
140 |
/**
|
|
141 |
* {@inheritDoc}
|
|
142 |
*/
|
|
143 |
public void writeComments(MemberDoc member) {
|
|
144 |
if (member.inlineTags().length > 0) {
|
|
145 |
writer.dd();
|
|
146 |
writer.printInlineComment(member);
|
|
147 |
}
|
|
148 |
}
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Write the tag output for the given member.
|
|
152 |
*
|
|
153 |
* @param member the member being documented.
|
|
154 |
*/
|
|
155 |
public void writeTags(MemberDoc member) {
|
|
156 |
writer.printTags(member);
|
|
157 |
}
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Write the annotation type member footer.
|
|
161 |
*/
|
|
162 |
public void writeMemberFooter() {
|
|
163 |
writer.dlEnd();
|
|
164 |
}
|
|
165 |
|
|
166 |
/**
|
|
167 |
* Write the footer for the annotation type member documentation.
|
|
168 |
*
|
|
169 |
* @param classDoc the class that the annotation type member belong to.
|
|
170 |
*/
|
|
171 |
public void writeFooter(ClassDoc classDoc) {
|
|
172 |
//No footer to write for annotation type member documentation
|
|
173 |
}
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Close the writer.
|
|
177 |
*/
|
|
178 |
public void close() throws IOException {
|
|
179 |
writer.close();
|
|
180 |
}
|
|
181 |
|
|
182 |
/**
|
|
183 |
* {@inheritDoc}
|
|
184 |
*/
|
|
185 |
public void printSummaryLabel(ClassDoc cd) {
|
|
186 |
writer.boldText("doclet.Annotation_Type_Required_Member_Summary");
|
|
187 |
}
|
|
188 |
|
|
189 |
/**
|
|
190 |
* {@inheritDoc}
|
|
191 |
*/
|
|
192 |
public void printSummaryAnchor(ClassDoc cd) {
|
|
193 |
writer.anchor("annotation_type_required_element_summary");
|
|
194 |
}
|
|
195 |
|
|
196 |
/**
|
|
197 |
* {@inheritDoc}
|
|
198 |
*/
|
|
199 |
public void printInheritedSummaryAnchor(ClassDoc cd) {
|
|
200 |
} // no such
|
|
201 |
|
|
202 |
/**
|
|
203 |
* {@inheritDoc}
|
|
204 |
*/
|
|
205 |
public void printInheritedSummaryLabel(ClassDoc cd) {
|
|
206 |
// no such
|
|
207 |
}
|
|
208 |
|
|
209 |
/**
|
|
210 |
* {@inheritDoc}
|
|
211 |
*/
|
|
212 |
protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
|
|
213 |
writer.bold();
|
|
214 |
writer.printDocLink(context, (MemberDoc) member, member.name(), false);
|
|
215 |
writer.boldEnd();
|
|
216 |
}
|
|
217 |
|
|
218 |
/**
|
|
219 |
* {@inheritDoc}
|
|
220 |
*/
|
|
221 |
protected void writeInheritedSummaryLink(ClassDoc cd,
|
|
222 |
ProgramElementDoc member) {
|
|
223 |
//Not applicable.
|
|
224 |
}
|
|
225 |
|
|
226 |
/**
|
|
227 |
* {@inheritDoc}
|
|
228 |
*/
|
|
229 |
protected void printSummaryType(ProgramElementDoc member) {
|
|
230 |
MemberDoc m = (MemberDoc)member;
|
|
231 |
printModifierAndType(m, getType(m));
|
|
232 |
}
|
|
233 |
|
|
234 |
/**
|
|
235 |
* {@inheritDoc}
|
|
236 |
*/
|
|
237 |
protected void writeDeprecatedLink(ProgramElementDoc member) {
|
|
238 |
writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
|
|
239 |
(MemberDoc) member, ((MemberDoc)member).qualifiedName(), false);
|
|
240 |
}
|
|
241 |
|
|
242 |
/**
|
|
243 |
* {@inheritDoc}
|
|
244 |
*/
|
|
245 |
protected void printNavSummaryLink(ClassDoc cd, boolean link) {
|
|
246 |
if (link) {
|
|
247 |
writer.printHyperLink("", "annotation_type_required_element_summary",
|
|
248 |
configuration().getText("doclet.navAnnotationTypeRequiredMember"));
|
|
249 |
} else {
|
|
250 |
writer.printText("doclet.navAnnotationTypeRequiredMember");
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
/**
|
|
255 |
* {@inheritDoc}
|
|
256 |
*/
|
|
257 |
protected void printNavDetailLink(boolean link) {
|
|
258 |
if (link) {
|
|
259 |
writer.printHyperLink("", "annotation_type_element_detail",
|
|
260 |
configuration().getText("doclet.navAnnotationTypeMember"));
|
|
261 |
} else {
|
|
262 |
writer.printText("doclet.navAnnotationTypeMember");
|
|
263 |
}
|
|
264 |
}
|
|
265 |
|
|
266 |
/**
|
|
267 |
* {@inheritDoc}
|
|
268 |
*/
|
|
269 |
public void writeDeprecated(MemberDoc member) {
|
|
270 |
print(((TagletOutputImpl)
|
|
271 |
(new DeprecatedTaglet()).getTagletOutput(member,
|
|
272 |
writer.getTagletWriterInstance(false))).toString());
|
|
273 |
}
|
|
274 |
|
|
275 |
private Type getType(MemberDoc member) {
|
|
276 |
if (member instanceof FieldDoc) {
|
|
277 |
return ((FieldDoc) member).type();
|
|
278 |
} else {
|
|
279 |
return ((MethodDoc) member).returnType();
|
|
280 |
}
|
|
281 |
}
|
|
282 |
}
|