author | jjg |
Tue, 09 Oct 2012 19:31:58 -0700 | |
changeset 14259 | fb94a1df0d53 |
parent 14258 | 8d2148961366 |
child 14260 | 727a84636f12 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
14258 | 2 |
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.doclets.internal.toolkit.builders; |
|
27 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
28 |
import java.io.*; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
29 |
import java.util.*; |
14258 | 30 |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
31 |
import com.sun.javadoc.*; |
14258 | 32 |
import com.sun.tools.doclets.internal.toolkit.*; |
10 | 33 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
34 |
||
35 |
/** |
|
36 |
* Builds the Constants Summary Page. |
|
37 |
* |
|
38 |
* This code is not part of an API. |
|
39 |
* It is implementation that is subject to change. |
|
40 |
* Do not use it as an API |
|
41 |
* |
|
42 |
* @author Jamie Ho |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
43 |
* @author Bhavesh Patel (Modified) |
10 | 44 |
* @since 1.5 |
45 |
*/ |
|
46 |
public class ConstantsSummaryBuilder extends AbstractBuilder { |
|
47 |
||
48 |
/** |
|
49 |
* The root element of the constant summary XML is {@value}. |
|
50 |
*/ |
|
51 |
public static final String ROOT = "ConstantSummary"; |
|
52 |
||
53 |
/** |
|
54 |
* The maximum number of package directories shown in the constant |
|
55 |
* value index. |
|
56 |
*/ |
|
57 |
public static final int MAX_CONSTANT_VALUE_INDEX_LENGTH = 2; |
|
58 |
||
59 |
/** |
|
60 |
* The writer used to write the results. |
|
61 |
*/ |
|
62 |
protected ConstantsSummaryWriter writer; |
|
63 |
||
64 |
/** |
|
65 |
* The set of ClassDocs that have constant fields. |
|
66 |
*/ |
|
868 | 67 |
protected Set<ClassDoc> classDocsWithConstFields; |
10 | 68 |
|
69 |
/** |
|
70 |
* The set of printed package headers. |
|
71 |
*/ |
|
868 | 72 |
protected Set<String> printedPackageHeaders; |
10 | 73 |
|
74 |
/** |
|
75 |
* The current package being documented. |
|
76 |
*/ |
|
77 |
private PackageDoc currentPackage; |
|
78 |
||
79 |
/** |
|
80 |
* The current class being documented. |
|
81 |
*/ |
|
82 |
private ClassDoc currentClass; |
|
83 |
||
84 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
85 |
* The content tree for the constant summary documentation. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
86 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
87 |
private Content contentTree; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
88 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
89 |
/** |
10 | 90 |
* Construct a new ConstantsSummaryBuilder. |
91 |
* |
|
92 |
* @param configuration the current configuration of the |
|
93 |
* doclet. |
|
94 |
*/ |
|
95 |
private ConstantsSummaryBuilder(Configuration configuration) { |
|
96 |
super(configuration); |
|
97 |
} |
|
98 |
||
99 |
/** |
|
100 |
* Construct a ConstantsSummaryBuilder. |
|
101 |
* |
|
102 |
* @param configuration the configuration used in this run |
|
103 |
* of the doclet. |
|
104 |
* @param writer the writer for the summary. |
|
105 |
*/ |
|
106 |
public static ConstantsSummaryBuilder getInstance( |
|
107 |
Configuration configuration, ConstantsSummaryWriter writer) { |
|
108 |
ConstantsSummaryBuilder builder = new ConstantsSummaryBuilder( |
|
109 |
configuration); |
|
110 |
builder.writer = writer; |
|
868 | 111 |
builder.classDocsWithConstFields = new HashSet<ClassDoc>(); |
10 | 112 |
return builder; |
113 |
} |
|
114 |
||
115 |
/** |
|
116 |
* {@inheritDoc} |
|
117 |
*/ |
|
118 |
public void build() throws IOException { |
|
119 |
if (writer == null) { |
|
120 |
//Doclet does not support this output. |
|
121 |
return; |
|
122 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
123 |
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); |
10 | 124 |
} |
125 |
||
126 |
/** |
|
127 |
* {@inheritDoc} |
|
128 |
*/ |
|
129 |
public String getName() { |
|
130 |
return ROOT; |
|
131 |
} |
|
132 |
||
133 |
/** |
|
134 |
* Build the constant summary. |
|
135 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
136 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
137 |
* @param contentTree the content tree to which the documentation will be added |
10 | 138 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
139 |
public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
140 |
contentTree = writer.getHeader(); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
141 |
buildChildren(node, contentTree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
142 |
writer.addFooter(contentTree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
143 |
writer.printDocument(contentTree); |
10 | 144 |
writer.close(); |
145 |
} |
|
146 |
||
147 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
148 |
* Build the list of packages. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
149 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
150 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
151 |
* @param contentTree the content tree to which the content list will be added |
10 | 152 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
153 |
public void buildContents(XMLNode node, Content contentTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
154 |
Content contentListTree = writer.getContentsHeader(); |
10 | 155 |
PackageDoc[] packages = configuration.packages; |
868 | 156 |
printedPackageHeaders = new HashSet<String>(); |
10 | 157 |
for (int i = 0; i < packages.length; i++) { |
158 |
if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) { |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
159 |
writer.addLinkToPackageContent(packages[i], |
10 | 160 |
parsePackageName(packages[i].name()), |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
161 |
printedPackageHeaders, contentListTree); |
10 | 162 |
} |
163 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
164 |
contentTree.addContent(writer.getContentsList(contentListTree)); |
10 | 165 |
} |
166 |
||
167 |
/** |
|
168 |
* Build the summary for each documented package. |
|
169 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
170 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
171 |
* @param contentTree the tree to which the summaries will be added |
10 | 172 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
173 |
public void buildConstantSummaries(XMLNode node, Content contentTree) { |
10 | 174 |
PackageDoc[] packages = configuration.packages; |
868 | 175 |
printedPackageHeaders = new HashSet<String>(); |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
176 |
Content summariesTree = writer.getConstantSummaries(); |
10 | 177 |
for (int i = 0; i < packages.length; i++) { |
178 |
if (hasConstantField(packages[i])) { |
|
179 |
currentPackage = packages[i]; |
|
180 |
//Build the documentation for the current package. |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
181 |
buildChildren(node, summariesTree); |
10 | 182 |
} |
183 |
} |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
184 |
contentTree.addContent(summariesTree); |
10 | 185 |
} |
186 |
||
187 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
188 |
* Build the header for the given package. |
10 | 189 |
* |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
190 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
191 |
* @param summariesTree the tree to which the package header will be added |
10 | 192 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
193 |
public void buildPackageHeader(XMLNode node, Content summariesTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
194 |
String parsedPackageName = parsePackageName(currentPackage.name()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
195 |
if (! printedPackageHeaders.contains(parsedPackageName)) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
196 |
writer.addPackageName(currentPackage, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
197 |
parsePackageName(currentPackage.name()), summariesTree); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
198 |
printedPackageHeaders.add(parsedPackageName); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
199 |
} |
10 | 200 |
} |
201 |
||
202 |
/** |
|
203 |
* Build the summary for the current class. |
|
204 |
* |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
205 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
206 |
* @param summariesTree the tree to which the class constant summary will be added |
10 | 207 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
208 |
public void buildClassConstantSummary(XMLNode node, Content summariesTree) { |
10 | 209 |
ClassDoc[] classes = currentPackage.name().length() > 0 ? |
210 |
currentPackage.allClasses() : |
|
211 |
configuration.classDocCatalog.allClasses( |
|
212 |
DocletConstants.DEFAULT_PACKAGE_NAME); |
|
213 |
Arrays.sort(classes); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
214 |
Content classConstantTree = writer.getClassConstantHeader(); |
10 | 215 |
for (int i = 0; i < classes.length; i++) { |
216 |
if (! classDocsWithConstFields.contains(classes[i]) || |
|
217 |
! classes[i].isIncluded()) { |
|
218 |
continue; |
|
219 |
} |
|
220 |
currentClass = classes[i]; |
|
221 |
//Build the documentation for the current class. |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
222 |
buildChildren(node, classConstantTree); |
10 | 223 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
224 |
summariesTree.addContent(classConstantTree); |
10 | 225 |
} |
226 |
||
227 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
228 |
* Build the summary of constant members in the class. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
229 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
230 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
231 |
* @param classConstantTree the tree to which the constant members table |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
232 |
* will be added |
10 | 233 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
234 |
public void buildConstantMembers(XMLNode node, Content classConstantTree) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
235 |
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree); |
10 | 236 |
} |
237 |
||
238 |
/** |
|
239 |
* Return true if the given package has constant fields to document. |
|
240 |
* |
|
241 |
* @param pkg the package being checked. |
|
242 |
* @return true if the given package has constant fields to document. |
|
243 |
*/ |
|
244 |
private boolean hasConstantField(PackageDoc pkg) { |
|
245 |
ClassDoc[] classes; |
|
246 |
if (pkg.name().length() > 0) { |
|
247 |
classes = pkg.allClasses(); |
|
248 |
} else { |
|
249 |
classes = configuration.classDocCatalog.allClasses( |
|
250 |
DocletConstants.DEFAULT_PACKAGE_NAME); |
|
251 |
} |
|
252 |
boolean found = false; |
|
253 |
for (int j = 0; j < classes.length; j++){ |
|
254 |
if (classes[j].isIncluded() && hasConstantField(classes[j])) { |
|
255 |
found = true; |
|
256 |
} |
|
257 |
} |
|
258 |
return found; |
|
259 |
} |
|
260 |
||
261 |
/** |
|
262 |
* Return true if the given class has constant fields to document. |
|
263 |
* |
|
264 |
* @param classDoc the class being checked. |
|
265 |
* @return true if the given package has constant fields to document. |
|
266 |
*/ |
|
267 |
private boolean hasConstantField (ClassDoc classDoc) { |
|
268 |
VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc, |
|
269 |
VisibleMemberMap.FIELDS, configuration.nodeprecated); |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1264
diff
changeset
|
270 |
List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration); |
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1264
diff
changeset
|
271 |
for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) { |
10 | 272 |
FieldDoc field = (FieldDoc) iter.next(); |
273 |
if (field.constantValueExpression() != null) { |
|
274 |
classDocsWithConstFields.add(classDoc); |
|
275 |
return true; |
|
276 |
} |
|
277 |
} |
|
278 |
return false; |
|
279 |
} |
|
280 |
||
281 |
/** |
|
282 |
* Return true if the given package name has been printed. Also |
|
283 |
* return true if the root of this package has been printed. |
|
284 |
* |
|
285 |
* @param pkgname the name of the package to check. |
|
286 |
*/ |
|
287 |
private boolean hasPrintedPackageIndex(String pkgname) { |
|
868 | 288 |
String[] list = printedPackageHeaders.toArray(new String[] {}); |
10 | 289 |
for (int i = 0; i < list.length; i++) { |
290 |
if (pkgname.startsWith(list[i])) { |
|
291 |
return true; |
|
292 |
} |
|
293 |
} |
|
294 |
return false; |
|
295 |
} |
|
296 |
||
297 |
/** |
|
298 |
* Print the table of constants. |
|
299 |
* |
|
300 |
* @author Jamie Ho |
|
301 |
* @since 1.4 |
|
302 |
*/ |
|
303 |
private class ConstantFieldBuilder { |
|
304 |
||
305 |
/** |
|
306 |
* The map used to get the visible variables. |
|
307 |
*/ |
|
308 |
protected VisibleMemberMap visibleMemberMapFields = null; |
|
309 |
||
310 |
/** |
|
311 |
* The map used to get the visible variables. |
|
312 |
*/ |
|
313 |
protected VisibleMemberMap visibleMemberMapEnumConst = null; |
|
314 |
||
315 |
/** |
|
316 |
* The classdoc that we are examining constants for. |
|
317 |
*/ |
|
318 |
protected ClassDoc classdoc; |
|
319 |
||
320 |
/** |
|
321 |
* Construct a ConstantFieldSubWriter. |
|
322 |
* @param classdoc the classdoc that we are examining constants for. |
|
323 |
*/ |
|
324 |
public ConstantFieldBuilder(ClassDoc classdoc) { |
|
325 |
this.classdoc = classdoc; |
|
326 |
visibleMemberMapFields = new VisibleMemberMap(classdoc, |
|
327 |
VisibleMemberMap.FIELDS, configuration.nodeprecated); |
|
328 |
visibleMemberMapEnumConst = new VisibleMemberMap(classdoc, |
|
329 |
VisibleMemberMap.ENUM_CONSTANTS, configuration.nodeprecated); |
|
330 |
} |
|
331 |
||
332 |
/** |
|
333 |
* Builds the table of constants for a given class. |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
334 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
335 |
* @param node the XML element that specifies which components to document |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
336 |
* @param classConstantTree the tree to which the class constants table |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
337 |
* will be added |
10 | 338 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
339 |
protected void buildMembersSummary(XMLNode node, Content classConstantTree) { |
868 | 340 |
List<FieldDoc> members = new ArrayList<FieldDoc>(members()); |
10 | 341 |
if (members.size() > 0) { |
342 |
Collections.sort(members); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5855
diff
changeset
|
343 |
writer.addConstantMembers(classdoc, members, classConstantTree); |
10 | 344 |
} |
345 |
} |
|
346 |
||
347 |
/** |
|
348 |
* Return the list of visible constant fields for the given classdoc. |
|
349 |
* @return the list of visible constant fields for the given classdoc. |
|
350 |
*/ |
|
868 | 351 |
protected List<FieldDoc> members() { |
352 |
List<ProgramElementDoc> l = visibleMemberMapFields.getLeafClassMembers(configuration); |
|
10 | 353 |
l.addAll(visibleMemberMapEnumConst.getLeafClassMembers(configuration)); |
868 | 354 |
Iterator<ProgramElementDoc> iter; |
10 | 355 |
|
356 |
if(l != null){ |
|
357 |
iter = l.iterator(); |
|
358 |
} else { |
|
359 |
return null; |
|
360 |
} |
|
868 | 361 |
List<FieldDoc> inclList = new LinkedList<FieldDoc>(); |
10 | 362 |
FieldDoc member; |
363 |
while(iter.hasNext()){ |
|
364 |
member = (FieldDoc)iter.next(); |
|
365 |
if(member.constantValue() != null){ |
|
366 |
inclList.add(member); |
|
367 |
} |
|
368 |
} |
|
369 |
return inclList; |
|
370 |
} |
|
371 |
} |
|
372 |
||
373 |
/** |
|
374 |
* Parse the package name. We only want to display package name up to |
|
375 |
* 2 levels. |
|
376 |
*/ |
|
377 |
private String parsePackageName(String pkgname) { |
|
378 |
int index = -1; |
|
379 |
for (int j = 0; j < MAX_CONSTANT_VALUE_INDEX_LENGTH; j++) { |
|
380 |
index = pkgname.indexOf(".", index + 1); |
|
381 |
} |
|
382 |
if (index != -1) { |
|
383 |
pkgname = pkgname.substring(0, index); |
|
384 |
} |
|
385 |
return pkgname; |
|
386 |
} |
|
387 |
} |