167 return; |
181 return; |
168 } |
182 } |
169 if (!serialClassFoundToDocument(classes)) { |
183 if (!serialClassFoundToDocument(classes)) { |
170 return; |
184 return; |
171 } |
185 } |
172 buildChildren(node); |
186 buildChildren(node, packageSerializedTree); |
173 } |
187 serializedSummariesTree.addContent(packageSerializedTree); |
174 |
188 } |
175 public void buildPackageHeader(XMLNode node) { |
189 |
176 writer.writePackageHeader(Util.getPackageName(currentPackage)); |
190 /** |
177 } |
191 * Build the package header. |
178 |
192 * |
179 public void buildClassSerializedForm(XMLNode node) { |
193 * @param node the XML element that specifies which components to document |
|
194 * @param packageSerializedTree content tree to which the documentation will be added |
|
195 */ |
|
196 public void buildPackageHeader(XMLNode node, Content packageSerializedTree) { |
|
197 packageSerializedTree.addContent(writer.getPackageHeader( |
|
198 Util.getPackageName(currentPackage))); |
|
199 } |
|
200 |
|
201 /** |
|
202 * Build the class serialized form. |
|
203 * |
|
204 * @param node the XML element that specifies which components to document |
|
205 * @param packageSerializedTree content tree to which the documentation will be added |
|
206 */ |
|
207 public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) { |
|
208 Content classSerializedTree = writer.getClassSerializedHeader(); |
180 ClassDoc[] classes = currentPackage.allClasses(false); |
209 ClassDoc[] classes = currentPackage.allClasses(false); |
181 Arrays.sort(classes); |
210 Arrays.sort(classes); |
182 for (int j = 0; j < classes.length; j++) { |
211 for (int j = 0; j < classes.length; j++) { |
183 currentClass = classes[j]; |
212 currentClass = classes[j]; |
184 fieldWriter = writer.getSerialFieldWriter(currentClass); |
213 fieldWriter = writer.getSerialFieldWriter(currentClass); |
185 methodWriter = writer.getSerialMethodWriter(currentClass); |
214 methodWriter = writer.getSerialMethodWriter(currentClass); |
186 if(currentClass.isClass() && currentClass.isSerializable()) { |
215 if(currentClass.isClass() && currentClass.isSerializable()) { |
187 if(!serialClassInclude(currentClass)) { |
216 if(!serialClassInclude(currentClass)) { |
188 continue; |
217 continue; |
189 } |
218 } |
190 buildChildren(node); |
219 Content classTree = writer.getClassHeader(currentClass); |
191 } |
220 buildChildren(node, classTree); |
192 } |
221 classSerializedTree.addContent(classTree); |
193 } |
222 } |
194 |
223 } |
195 public void buildClassHeader(XMLNode node) { |
224 packageSerializedTree.addContent(classSerializedTree); |
196 writer.writeClassHeader(currentClass); |
|
197 } |
225 } |
198 |
226 |
199 /** |
227 /** |
200 * Build the serial UID information for the given class. |
228 * Build the serial UID information for the given class. |
201 */ |
229 * |
202 public void buildSerialUIDInfo(XMLNode node) { |
230 * @param node the XML element that specifies which components to document |
|
231 * @param classTree content tree to which the serial UID information will be added |
|
232 */ |
|
233 public void buildSerialUIDInfo(XMLNode node, Content classTree) { |
|
234 Content serialUidTree = writer.getSerialUIDInfoHeader(); |
203 FieldDoc[] fields = currentClass.fields(false); |
235 FieldDoc[] fields = currentClass.fields(false); |
204 for (int i = 0; i < fields.length; i++) { |
236 for (int i = 0; i < fields.length; i++) { |
205 if (fields[i].name().equals("serialVersionUID") && |
237 if (fields[i].name().equals("serialVersionUID") && |
206 fields[i].constantValueExpression() != null) { |
238 fields[i].constantValueExpression() != null) { |
207 writer.writeSerialUIDInfo(SERIAL_VERSION_UID_HEADER, |
239 writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, |
208 fields[i].constantValueExpression()); |
240 fields[i].constantValueExpression(), serialUidTree); |
209 return; |
241 break; |
210 } |
242 } |
211 } |
243 } |
212 } |
244 classTree.addContent(serialUidTree); |
213 |
245 } |
214 /** |
246 |
215 * Build the footer. |
247 /** |
216 */ |
248 * Build the summaries for the methods and fields. |
217 public void buildFooter(XMLNode node) { |
249 * |
218 writer.writeFooter(); |
250 * @param node the XML element that specifies which components to document |
|
251 * @param classTree content tree to which the documentation will be added |
|
252 */ |
|
253 public void buildClassContent(XMLNode node, Content classTree) { |
|
254 Content classContentTree = writer.getClassContentHeader(); |
|
255 buildChildren(node, classContentTree); |
|
256 classTree.addContent(classContentTree); |
|
257 } |
|
258 |
|
259 /** |
|
260 * Build the summaries for the methods that belong to the given |
|
261 * class. |
|
262 * |
|
263 * @param node the XML element that specifies which components to document |
|
264 * @param classContentTree content tree to which the documentation will be added |
|
265 */ |
|
266 public void buildSerializableMethods(XMLNode node, Content classContentTree) { |
|
267 Content serializableMethodTree = methodWriter.getSerializableMethodsHeader(); |
|
268 MemberDoc[] members = currentClass.serializationMethods(); |
|
269 int membersLength = members.length; |
|
270 if (membersLength > 0) { |
|
271 for (int i = 0; i < membersLength; i++) { |
|
272 currentMember = members[i]; |
|
273 Content methodsContentTree = methodWriter.getMethodsContentHeader( |
|
274 (i == membersLength - 1)); |
|
275 buildChildren(node, methodsContentTree); |
|
276 serializableMethodTree.addContent(methodsContentTree); |
|
277 } |
|
278 } |
|
279 if (currentClass.serializationMethods().length > 0) { |
|
280 classContentTree.addContent(methodWriter.getSerializableMethods( |
|
281 configuration.getText("doclet.Serialized_Form_methods"), |
|
282 serializableMethodTree)); |
|
283 if (currentClass.isSerializable() && !currentClass.isExternalizable()) { |
|
284 if (currentClass.serializationMethods().length == 0) { |
|
285 Content noCustomizationMsg = methodWriter.getNoCustomizationMsg( |
|
286 configuration.getText( |
|
287 "doclet.Serializable_no_customization")); |
|
288 classContentTree.addContent(methodWriter.getSerializableMethods( |
|
289 configuration.getText("doclet.Serialized_Form_methods"), |
|
290 noCustomizationMsg)); |
|
291 } |
|
292 } |
|
293 } |
|
294 } |
|
295 |
|
296 /** |
|
297 * Build the method sub header. |
|
298 * |
|
299 * @param node the XML element that specifies which components to document |
|
300 * @param methodsContentTree content tree to which the documentation will be added |
|
301 */ |
|
302 public void buildMethodSubHeader(XMLNode node, Content methodsContentTree) { |
|
303 methodWriter.addMemberHeader((MethodDoc)currentMember, methodsContentTree); |
|
304 } |
|
305 |
|
306 /** |
|
307 * Build the deprecated method description. |
|
308 * |
|
309 * @param node the XML element that specifies which components to document |
|
310 * @param methodsContentTree content tree to which the documentation will be added |
|
311 */ |
|
312 public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) { |
|
313 methodWriter.addDeprecatedMemberInfo((MethodDoc) currentMember, methodsContentTree); |
|
314 } |
|
315 |
|
316 /** |
|
317 * Build the information for the method. |
|
318 * |
|
319 * @param node the XML element that specifies which components to document |
|
320 * @param methodsContentTree content tree to which the documentation will be added |
|
321 */ |
|
322 public void buildMethodInfo(XMLNode node, Content methodsContentTree) { |
|
323 if(configuration.nocomment){ |
|
324 return; |
|
325 } |
|
326 buildChildren(node, methodsContentTree); |
|
327 } |
|
328 |
|
329 /** |
|
330 * Build method description. |
|
331 * |
|
332 * @param node the XML element that specifies which components to document |
|
333 * @param methodsContentTree content tree to which the documentation will be added |
|
334 */ |
|
335 public void buildMethodDescription(XMLNode node, Content methodsContentTree) { |
|
336 methodWriter.addMemberDescription((MethodDoc) currentMember, methodsContentTree); |
|
337 } |
|
338 |
|
339 /** |
|
340 * Build the method tags. |
|
341 * |
|
342 * @param node the XML element that specifies which components to document |
|
343 * @param methodsContentTree content tree to which the documentation will be added |
|
344 */ |
|
345 public void buildMethodTags(XMLNode node, Content methodsContentTree) { |
|
346 methodWriter.addMemberTags((MethodDoc) currentMember, methodsContentTree); |
|
347 MethodDoc method = (MethodDoc)currentMember; |
|
348 if (method.name().compareTo("writeExternal") == 0 |
|
349 && method.tags("serialData").length == 0) { |
|
350 if (configuration.serialwarn) { |
|
351 configuration.getDocletSpecificMsg().warning( |
|
352 currentMember.position(), "doclet.MissingSerialDataTag", |
|
353 method.containingClass().qualifiedName(), method.name()); |
|
354 } |
|
355 } |
|
356 } |
|
357 |
|
358 /** |
|
359 * Build the field header. |
|
360 * |
|
361 * @param node the XML element that specifies which components to document |
|
362 * @param classContentTree content tree to which the documentation will be added |
|
363 */ |
|
364 public void buildFieldHeader(XMLNode node, Content classContentTree) { |
|
365 if (currentClass.serializableFields().length > 0) { |
|
366 buildFieldSerializationOverview(currentClass, classContentTree); |
|
367 } |
|
368 } |
|
369 |
|
370 /** |
|
371 * Build the serialization overview for the given class. |
|
372 * |
|
373 * @param classDoc the class to print the overview for. |
|
374 * @param classContentTree content tree to which the documentation will be added |
|
375 */ |
|
376 public void buildFieldSerializationOverview(ClassDoc classDoc, Content classContentTree) { |
|
377 if (classDoc.definesSerializableFields()) { |
|
378 FieldDoc serialPersistentField = |
|
379 Util.asList(classDoc.serializableFields()).get(0); |
|
380 // Check to see if there are inline comments, tags or deprecation |
|
381 // information to be printed. |
|
382 if (fieldWriter.shouldPrintOverview(serialPersistentField)) { |
|
383 Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); |
|
384 Content fieldsOverviewContentTree = fieldWriter.getFieldsContentHeader(true); |
|
385 fieldWriter.addMemberDeprecatedInfo(serialPersistentField, |
|
386 fieldsOverviewContentTree); |
|
387 if (!configuration.nocomment) { |
|
388 fieldWriter.addMemberDescription(serialPersistentField, |
|
389 fieldsOverviewContentTree); |
|
390 fieldWriter.addMemberTags(serialPersistentField, |
|
391 fieldsOverviewContentTree); |
|
392 } |
|
393 serializableFieldsTree.addContent(fieldsOverviewContentTree); |
|
394 classContentTree.addContent(fieldWriter.getSerializableFields( |
|
395 configuration.getText("doclet.Serialized_Form_class"), |
|
396 serializableFieldsTree)); |
|
397 } |
|
398 } |
|
399 } |
|
400 |
|
401 /** |
|
402 * Build the summaries for the fields that belong to the given class. |
|
403 * |
|
404 * @param node the XML element that specifies which components to document |
|
405 * @param classContentTree content tree to which the documentation will be added |
|
406 */ |
|
407 public void buildSerializableFields(XMLNode node, Content classContentTree) { |
|
408 MemberDoc[] members = currentClass.serializableFields(); |
|
409 int membersLength = members.length; |
|
410 if (membersLength > 0) { |
|
411 Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); |
|
412 for (int i = 0; i < membersLength; i++) { |
|
413 currentMember = members[i]; |
|
414 if (!currentClass.definesSerializableFields()) { |
|
415 Content fieldsContentTree = fieldWriter.getFieldsContentHeader( |
|
416 (i == membersLength - 1)); |
|
417 buildChildren(node, fieldsContentTree); |
|
418 serializableFieldsTree.addContent(fieldsContentTree); |
|
419 } |
|
420 else { |
|
421 buildSerialFieldTagsInfo(serializableFieldsTree); |
|
422 } |
|
423 } |
|
424 classContentTree.addContent(fieldWriter.getSerializableFields( |
|
425 configuration.getText("doclet.Serialized_Form_fields"), |
|
426 serializableFieldsTree)); |
|
427 } |
|
428 } |
|
429 |
|
430 /** |
|
431 * Build the field sub header. |
|
432 * |
|
433 * @param node the XML element that specifies which components to document |
|
434 * @param fieldsContentTree content tree to which the documentation will be added |
|
435 */ |
|
436 public void buildFieldSubHeader(XMLNode node, Content fieldsContentTree) { |
|
437 if (!currentClass.definesSerializableFields()) { |
|
438 FieldDoc field = (FieldDoc) currentMember; |
|
439 fieldWriter.addMemberHeader(field.type().asClassDoc(), |
|
440 field.type().typeName(), field.type().dimension(), field.name(), |
|
441 fieldsContentTree); |
|
442 } |
|
443 } |
|
444 |
|
445 /** |
|
446 * Build the field deprecation information. |
|
447 * |
|
448 * @param node the XML element that specifies which components to document |
|
449 * @param fieldsContentTree content tree to which the documentation will be added |
|
450 */ |
|
451 public void buildFieldDeprecationInfo(XMLNode node, Content fieldsContentTree) { |
|
452 if (!currentClass.definesSerializableFields()) { |
|
453 FieldDoc field = (FieldDoc)currentMember; |
|
454 fieldWriter.addMemberDeprecatedInfo(field, fieldsContentTree); |
|
455 } |
|
456 } |
|
457 |
|
458 /** |
|
459 * Build the serial field tags information. |
|
460 * |
|
461 * @param serializableFieldsTree content tree to which the documentation will be added |
|
462 */ |
|
463 public void buildSerialFieldTagsInfo(Content serializableFieldsTree) { |
|
464 if(configuration.nocomment){ |
|
465 return; |
|
466 } |
|
467 FieldDoc field = (FieldDoc)currentMember; |
|
468 // Process Serializable Fields specified as array of |
|
469 // ObjectStreamFields. Print a member for each serialField tag. |
|
470 // (There should be one serialField tag per ObjectStreamField |
|
471 // element.) |
|
472 SerialFieldTag[] tags = field.serialFieldTags(); |
|
473 Arrays.sort(tags); |
|
474 int tagsLength = tags.length; |
|
475 for (int i = 0; i < tagsLength; i++) { |
|
476 Content fieldsContentTree = fieldWriter.getFieldsContentHeader( |
|
477 (i == tagsLength - 1)); |
|
478 fieldWriter.addMemberHeader(tags[i].fieldTypeDoc(), |
|
479 tags[i].fieldType(), "", tags[i].fieldName(), fieldsContentTree); |
|
480 fieldWriter.addMemberDescription(tags[i], fieldsContentTree); |
|
481 serializableFieldsTree.addContent(fieldsContentTree); |
|
482 } |
|
483 } |
|
484 |
|
485 /** |
|
486 * Build the field information. |
|
487 * |
|
488 * @param node the XML element that specifies which components to document |
|
489 * @param fieldsContentTree content tree to which the documentation will be added |
|
490 */ |
|
491 public void buildFieldInfo(XMLNode node, Content fieldsContentTree) { |
|
492 if(configuration.nocomment){ |
|
493 return; |
|
494 } |
|
495 FieldDoc field = (FieldDoc)currentMember; |
|
496 ClassDoc cd = field.containingClass(); |
|
497 // Process default Serializable field. |
|
498 if ((field.tags("serial").length == 0) && ! field.isSynthetic() |
|
499 && configuration.serialwarn) { |
|
500 configuration.message.warning(field.position(), |
|
501 "doclet.MissingSerialTag", cd.qualifiedName(), |
|
502 field.name()); |
|
503 } |
|
504 fieldWriter.addMemberDescription(field, fieldsContentTree); |
|
505 fieldWriter.addMemberTags(field, fieldsContentTree); |
219 } |
506 } |
220 |
507 |
221 /** |
508 /** |
222 * Return true if the given Doc should be included |
509 * Return true if the given Doc should be included |
223 * in the serialized form. |
510 * in the serialized form. |
295 return true; |
582 return true; |
296 } |
583 } |
297 } |
584 } |
298 return false; |
585 return false; |
299 } |
586 } |
300 |
|
301 /** |
|
302 * Build the method header. |
|
303 */ |
|
304 public void buildMethodHeader(XMLNode node) { |
|
305 if (currentClass.serializationMethods().length > 0) { |
|
306 methodWriter.writeHeader( |
|
307 configuration.getText("doclet.Serialized_Form_methods")); |
|
308 if (currentClass.isSerializable() && !currentClass.isExternalizable()) { |
|
309 if (currentClass.serializationMethods().length == 0) { |
|
310 methodWriter.writeNoCustomizationMsg( |
|
311 configuration.getText( |
|
312 "doclet.Serializable_no_customization")); |
|
313 } |
|
314 } |
|
315 } |
|
316 } |
|
317 |
|
318 /** |
|
319 * Build the method sub header. |
|
320 */ |
|
321 public void buildMethodSubHeader(XMLNode node) { |
|
322 methodWriter.writeMemberHeader((MethodDoc) currentMember); |
|
323 } |
|
324 |
|
325 /** |
|
326 * Build the deprecated method description. |
|
327 */ |
|
328 public void buildDeprecatedMethodInfo(XMLNode node) { |
|
329 methodWriter.writeDeprecatedMemberInfo((MethodDoc) currentMember); |
|
330 } |
|
331 |
|
332 /** |
|
333 * Build method tags. |
|
334 */ |
|
335 public void buildMethodDescription(XMLNode node) { |
|
336 methodWriter.writeMemberDescription((MethodDoc) currentMember); |
|
337 } |
|
338 |
|
339 /** |
|
340 * Build the method tags. |
|
341 */ |
|
342 public void buildMethodTags(XMLNode node) { |
|
343 methodWriter.writeMemberTags((MethodDoc) currentMember); |
|
344 MethodDoc method = (MethodDoc)currentMember; |
|
345 if (method.name().compareTo("writeExternal") == 0 |
|
346 && method.tags("serialData").length == 0) { |
|
347 if (configuration.serialwarn) { |
|
348 configuration.getDocletSpecificMsg().warning( |
|
349 currentMember.position(), "doclet.MissingSerialDataTag", |
|
350 method.containingClass().qualifiedName(), method.name()); |
|
351 } |
|
352 } |
|
353 } |
|
354 |
|
355 /** |
|
356 * build the information for the method. |
|
357 */ |
|
358 public void buildMethodInfo(XMLNode node) { |
|
359 if(configuration.nocomment){ |
|
360 return; |
|
361 } |
|
362 buildChildren(node); |
|
363 } |
|
364 |
|
365 /** |
|
366 * Build the method footer. |
|
367 */ |
|
368 public void buildMethodFooter(XMLNode node) { |
|
369 methodWriter.writeMemberFooter(); |
|
370 } |
|
371 |
|
372 /** |
|
373 * Build the field header. |
|
374 */ |
|
375 public void buildFieldHeader(XMLNode node) { |
|
376 if (currentClass.serializableFields().length > 0) { |
|
377 buildFieldSerializationOverview(currentClass); |
|
378 fieldWriter.writeHeader(configuration.getText( |
|
379 "doclet.Serialized_Form_fields")); |
|
380 } |
|
381 } |
|
382 |
|
383 /** |
|
384 * If possible, build the serialization overview for the given |
|
385 * class. |
|
386 * |
|
387 * @param classDoc the class to print the overview for. |
|
388 */ |
|
389 public void buildFieldSerializationOverview(ClassDoc classDoc) { |
|
390 if (classDoc.definesSerializableFields()) { |
|
391 FieldDoc serialPersistentField = |
|
392 Util.asList(classDoc.serializableFields()).get(0); |
|
393 // Check to see if there are inline comments, tags or deprecation |
|
394 // information to be printed. |
|
395 if (fieldWriter.shouldPrintOverview(serialPersistentField)) { |
|
396 fieldWriter.writeHeader( |
|
397 configuration.getText("doclet.Serialized_Form_class")); |
|
398 fieldWriter.writeMemberDeprecatedInfo(serialPersistentField); |
|
399 if (!configuration.nocomment) { |
|
400 fieldWriter.writeMemberDescription(serialPersistentField); |
|
401 fieldWriter.writeMemberTags(serialPersistentField); |
|
402 } |
|
403 // Footer required to close the definition list tag |
|
404 // for serialization overview. |
|
405 fieldWriter.writeFooter( |
|
406 configuration.getText("doclet.Serialized_Form_class")); |
|
407 } |
|
408 } |
|
409 } |
|
410 |
|
411 /** |
|
412 * Build the field sub header. |
|
413 */ |
|
414 public void buildFieldSubHeader(XMLNode node) { |
|
415 if (! currentClass.definesSerializableFields() ){ |
|
416 FieldDoc field = (FieldDoc) currentMember; |
|
417 fieldWriter.writeMemberHeader(field.type().asClassDoc(), |
|
418 field.type().typeName(), field.type().dimension(), field.name()); |
|
419 } |
|
420 } |
|
421 |
|
422 /** |
|
423 * Build the field deprecation information. |
|
424 */ |
|
425 public void buildFieldDeprecationInfo(XMLNode node) { |
|
426 if (!currentClass.definesSerializableFields()) { |
|
427 FieldDoc field = (FieldDoc)currentMember; |
|
428 fieldWriter.writeMemberDeprecatedInfo(field); |
|
429 } |
|
430 } |
|
431 |
|
432 /** |
|
433 * Build the field information. |
|
434 */ |
|
435 public void buildFieldInfo(XMLNode node) { |
|
436 if(configuration.nocomment){ |
|
437 return; |
|
438 } |
|
439 FieldDoc field = (FieldDoc)currentMember; |
|
440 ClassDoc cd = field.containingClass(); |
|
441 if (cd.definesSerializableFields()) { |
|
442 // Process Serializable Fields specified as array of |
|
443 // ObjectStreamFields. Print a member for each serialField tag. |
|
444 // (There should be one serialField tag per ObjectStreamField |
|
445 // element.) |
|
446 SerialFieldTag[] tags = field.serialFieldTags(); |
|
447 Arrays.sort(tags); |
|
448 for (int i = 0; i < tags.length; i++) { |
|
449 fieldWriter.writeMemberHeader(tags[i].fieldTypeDoc(), |
|
450 tags[i].fieldType(), "", tags[i].fieldName()); |
|
451 fieldWriter.writeMemberDescription(tags[i]); |
|
452 |
|
453 } |
|
454 } else { |
|
455 |
|
456 // Process default Serializable field. |
|
457 if ((field.tags("serial").length == 0) && ! field.isSynthetic() |
|
458 && configuration.serialwarn) { |
|
459 configuration.message.warning(field.position(), |
|
460 "doclet.MissingSerialTag", cd.qualifiedName(), |
|
461 field.name()); |
|
462 } |
|
463 fieldWriter.writeMemberDescription(field); |
|
464 fieldWriter.writeMemberTags(field); |
|
465 } |
|
466 } |
|
467 |
|
468 /** |
|
469 * Build the field sub footer. |
|
470 */ |
|
471 public void buildFieldSubFooter(XMLNode node) { |
|
472 if (! currentClass.definesSerializableFields()) { |
|
473 fieldWriter.writeMemberFooter(); |
|
474 } |
|
475 } |
|
476 |
|
477 /** |
|
478 * Build the summaries for the methods that belong to the given |
|
479 * class. |
|
480 */ |
|
481 public void buildSerializableMethods(XMLNode node) { |
|
482 MemberDoc[] members = currentClass.serializationMethods(); |
|
483 if (members.length > 0) { |
|
484 for (int i = 0; i < members.length; i++) { |
|
485 currentMember = members[i]; |
|
486 buildChildren(node); |
|
487 } |
|
488 } |
|
489 } |
|
490 |
|
491 /** |
|
492 * Build the summaries for the fields that belong to the given |
|
493 * class. |
|
494 */ |
|
495 public void buildSerializableFields(XMLNode node) { |
|
496 MemberDoc[] members = currentClass.serializableFields(); |
|
497 if (members.length > 0) { |
|
498 for (int i = 0; i < members.length; i++) { |
|
499 currentMember = members[i]; |
|
500 buildChildren(node); |
|
501 } |
|
502 } |
|
503 } |
|
504 } |
587 } |