52 public static final String ROOT = "ClassDoc"; |
52 public static final String ROOT = "ClassDoc"; |
53 |
53 |
54 /** |
54 /** |
55 * The class being documented. |
55 * The class being documented. |
56 */ |
56 */ |
57 private ClassDoc classDoc; |
57 private final ClassDoc classDoc; |
58 |
58 |
59 /** |
59 /** |
60 * The doclet specific writer. |
60 * The doclet specific writer. |
61 */ |
61 */ |
62 private ClassWriter writer; |
62 private final ClassWriter writer; |
63 |
63 |
64 /** |
64 /** |
65 * Keep track of whether or not this classdoc is an interface. |
65 * Keep track of whether or not this classdoc is an interface. |
66 */ |
66 */ |
67 private boolean isInterface = false; |
67 private final boolean isInterface; |
68 |
68 |
69 /** |
69 /** |
70 * Keep track of whether or not this classdoc is an enum. |
70 * Keep track of whether or not this classdoc is an enum. |
71 */ |
71 */ |
72 private boolean isEnum = false; |
72 private final boolean isEnum; |
73 |
73 |
74 /** |
74 /** |
75 * The content tree for the class documentation. |
75 * The content tree for the class documentation. |
76 */ |
76 */ |
77 private Content contentTree; |
77 private Content contentTree; |
78 |
78 |
79 /** |
79 /** |
80 * Construct a new ClassBuilder. |
80 * Construct a new ClassBuilder. |
81 * |
81 * |
82 * @param configuration the current configuration of the |
82 * @param context the build context |
83 * doclet. |
|
84 */ |
|
85 private ClassBuilder(Configuration configuration) { |
|
86 super(configuration); |
|
87 } |
|
88 |
|
89 /** |
|
90 * Construct a new ClassBuilder. |
|
91 * |
|
92 * @param configuration the current configuration of the doclet. |
|
93 * @param classDoc the class being documented. |
83 * @param classDoc the class being documented. |
94 * @param writer the doclet specific writer. |
84 * @param writer the doclet specific writer. |
95 */ |
85 */ |
96 public static ClassBuilder getInstance(Configuration configuration, |
86 private ClassBuilder(Context context, |
97 ClassDoc classDoc, ClassWriter writer) |
87 ClassDoc classDoc, ClassWriter writer) { |
98 throws Exception { |
88 super(context); |
99 ClassBuilder builder = new ClassBuilder(configuration); |
89 this.classDoc = classDoc; |
100 builder.configuration = configuration; |
90 this.writer = writer; |
101 builder.classDoc = classDoc; |
|
102 builder.writer = writer; |
|
103 if (classDoc.isInterface()) { |
91 if (classDoc.isInterface()) { |
104 builder.isInterface = true; |
92 isInterface = true; |
|
93 isEnum = false; |
105 } else if (classDoc.isEnum()) { |
94 } else if (classDoc.isEnum()) { |
106 builder.isEnum = true; |
95 isInterface = false; |
|
96 isEnum = true; |
107 Util.setEnumDocumentation(configuration, classDoc); |
97 Util.setEnumDocumentation(configuration, classDoc); |
|
98 } else { |
|
99 isInterface = false; |
|
100 isEnum = false; |
108 } |
101 } |
109 if(containingPackagesSeen == null) { |
102 } |
110 containingPackagesSeen = new HashSet<String>(); |
103 |
111 } |
104 /** |
112 return builder; |
105 * Construct a new ClassBuilder. |
|
106 * |
|
107 * @param context the build context |
|
108 * @param classDoc the class being documented. |
|
109 * @param writer the doclet specific writer. |
|
110 */ |
|
111 public static ClassBuilder getInstance(Context context, |
|
112 ClassDoc classDoc, ClassWriter writer) { |
|
113 return new ClassBuilder(context, classDoc, writer); |
113 } |
114 } |
114 |
115 |
115 /** |
116 /** |
116 * {@inheritDoc} |
117 * {@inheritDoc} |
117 */ |
118 */ |
118 public void build() throws IOException { |
119 public void build() throws IOException { |
119 build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); |
120 build(layoutParser.parseXML(ROOT), contentTree); |
120 } |
121 } |
121 |
122 |
122 /** |
123 /** |
123 * {@inheritDoc} |
124 * {@inheritDoc} |
124 */ |
125 */ |