01: /*
02: * Author: Mike Atkinson
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.pretty.jdi;
10:
11: import net.sourceforge.jrefactory.ast.ASTClassDeclaration;
12: import net.sourceforge.jrefactory.ast.ASTUnmodifiedClassDeclaration;
13: import net.sourceforge.jrefactory.ast.ASTAnnotation;
14: import net.sourceforge.jrefactory.ast.Node;
15: import org.acm.seguin.pretty.DescriptionPadder;
16: import org.acm.seguin.pretty.ForceJavadocComments;
17: import org.acm.seguin.pretty.PrintData;
18: import org.acm.seguin.pretty.ai.RequiredTags;
19:
20: /**
21: * Holds a class declaration. Contains the list of modifiers for the class and the javadoc comments.
22: *
23: * @author Mike Atkinson
24: * @since jRefactory 2.9.0, created October 16, 2003
25: */
26: public class ClassDeclaration extends BaseJDI {
27: private ASTClassDeclaration clazz;
28:
29: /**
30: * Constructor for the ClassDeclaration JavaDoc creator.
31: *
32: * @param clazz Create JavaDoc for this node.
33: */
34: public ClassDeclaration(ASTClassDeclaration clazz) {
35: super ();
36: this .clazz = clazz;
37: }
38:
39: /**
40: * Checks to see if it was printed
41: *
42: * @return true if it still needs to be printed
43: */
44: public boolean isRequired() {
45: return jdi.isRequired()
46: && (new ForceJavadocComments()).isJavaDocRequired(
47: "class", clazz);
48: }
49:
50: /**
51: * Prints all the java doc components
52: *
53: * @param printData the print data
54: */
55: public void printJavaDocComponents(PrintData printData) {
56: jdi.printJavaDocComponents(printData, bundle
57: .getString("class.tags"));
58: }
59:
60: /**
61: * Makes sure all the java doc components are present. For classes and interfaces, this means a date and an author.
62: */
63: public void finish() {
64: // Description of the class
65: jdi.require("", DescriptionPadder.find(bundle, "class.descr"));
66:
67: // Require the other tags
68: int childNo = clazz.skipAnnotations();
69: Node child = clazz.jjtGetChild(childNo);
70: RequiredTags.getTagger().addTags(bundle, "class",
71: ((ASTUnmodifiedClassDeclaration) child).getName(), jdi);
72: }
73:
74: }
|