10
|
1 |
/*
|
|
2 |
* Copyright 1998-2003 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 |
/**
|
|
33 |
* Generate serialized form for Serializable/Externalizable methods.
|
|
34 |
* Documentation denoted by the <code>serialData</code> tag is processed.
|
|
35 |
*
|
|
36 |
* @author Joe Fialli
|
|
37 |
*/
|
|
38 |
public class HtmlSerialMethodWriter extends MethodWriterImpl implements
|
|
39 |
SerializedFormWriter.SerialMethodWriter{
|
|
40 |
|
|
41 |
private boolean printedFirstMember = false;
|
|
42 |
|
|
43 |
public HtmlSerialMethodWriter(SubWriterHolderWriter writer,
|
|
44 |
ClassDoc classdoc) {
|
|
45 |
super(writer, classdoc);
|
|
46 |
}
|
|
47 |
|
|
48 |
public void writeHeader(String heading) {
|
|
49 |
writer.anchor("serialized_methods");
|
|
50 |
writer.printTableHeadingBackground(heading);
|
|
51 |
writer.p();
|
|
52 |
}
|
|
53 |
|
|
54 |
public void writeNoCustomizationMsg(String msg) {
|
|
55 |
writer.print(msg);
|
|
56 |
writer.p();
|
|
57 |
}
|
|
58 |
|
|
59 |
public void writeMemberHeader(MethodDoc member) {
|
|
60 |
if (printedFirstMember) {
|
|
61 |
writer.printMemberHeader();
|
|
62 |
}
|
|
63 |
printedFirstMember = true;
|
|
64 |
writer.anchor(member);
|
|
65 |
printHead(member);
|
|
66 |
writeSignature(member);
|
|
67 |
}
|
|
68 |
|
|
69 |
public void writeMemberFooter(MethodDoc member) {
|
|
70 |
writer.dlEnd();
|
|
71 |
}
|
|
72 |
|
|
73 |
public void writeDeprecatedMemberInfo(MethodDoc member) {
|
|
74 |
print(((TagletOutputImpl)
|
|
75 |
(new DeprecatedTaglet()).getTagletOutput(member,
|
|
76 |
writer.getTagletWriterInstance(false))).toString());
|
|
77 |
}
|
|
78 |
|
|
79 |
public void writeMemberDescription(MethodDoc member) {
|
|
80 |
printComment(member);
|
|
81 |
}
|
|
82 |
|
|
83 |
public void writeMemberTags(MethodDoc member) {
|
|
84 |
writer.dd();
|
|
85 |
writer.dl();
|
|
86 |
TagletOutputImpl output = new TagletOutputImpl("");
|
|
87 |
TagletManager tagletManager =
|
|
88 |
ConfigurationImpl.getInstance().tagletManager;
|
|
89 |
TagletWriter.genTagOuput(tagletManager, member,
|
|
90 |
tagletManager.getSerializedFormTags(),
|
|
91 |
writer.getTagletWriterInstance(false), output);
|
|
92 |
print(output.toString());
|
868
|
93 |
MethodDoc method = member;
|
10
|
94 |
if (method.name().compareTo("writeExternal") == 0
|
|
95 |
&& method.tags("serialData").length == 0) {
|
|
96 |
serialWarning(member.position(), "doclet.MissingSerialDataTag",
|
|
97 |
method.containingClass().qualifiedName(), method.name());
|
|
98 |
}
|
|
99 |
writer.ddEnd();
|
|
100 |
writer.dlEnd();
|
|
101 |
}
|
|
102 |
|
|
103 |
protected void printTypeLinkNoDimension(Type type) {
|
|
104 |
ClassDoc cd = type.asClassDoc();
|
|
105 |
if (type.isPrimitive() || cd.isPackagePrivate()) {
|
|
106 |
print(type.typeName());
|
|
107 |
} else {
|
|
108 |
writer.printLink(new LinkInfoImpl(
|
|
109 |
LinkInfoImpl.CONTEXT_SERIAL_MEMBER,type));
|
|
110 |
}
|
|
111 |
}
|
|
112 |
}
|