27 |
27 |
28 import com.sun.tools.doclets.internal.toolkit.util.*; |
28 import com.sun.tools.doclets.internal.toolkit.util.*; |
29 import com.sun.tools.doclets.internal.toolkit.*; |
29 import com.sun.tools.doclets.internal.toolkit.*; |
30 import com.sun.javadoc.*; |
30 import com.sun.javadoc.*; |
31 import java.util.*; |
31 import java.util.*; |
32 import java.lang.reflect.*; |
32 |
33 /** |
33 /** |
34 * Builds documentation for a method. |
34 * Builds documentation for a method. |
35 * |
35 * |
36 * This code is not part of an API. |
36 * This code is not part of an API. |
37 * It is implementation that is subject to change. |
37 * It is implementation that is subject to change. |
110 public String getName() { |
110 public String getName() { |
111 return "MethodDetails"; |
111 return "MethodDetails"; |
112 } |
112 } |
113 |
113 |
114 /** |
114 /** |
115 * {@inheritDoc} |
|
116 */ |
|
117 public void invokeMethod( |
|
118 String methodName, |
|
119 Class<?>[] paramClasses, |
|
120 Object[] params) |
|
121 throws Exception { |
|
122 if (DEBUG) { |
|
123 configuration.root.printError( |
|
124 "DEBUG: " + this.getClass().getName() + "." + methodName); |
|
125 } |
|
126 Method method = this.getClass().getMethod(methodName, paramClasses); |
|
127 method.invoke(this, params); |
|
128 } |
|
129 |
|
130 /** |
|
131 * Returns a list of methods that will be documented for the given class. |
115 * Returns a list of methods that will be documented for the given class. |
132 * This information can be used for doclet specific documentation |
116 * This information can be used for doclet specific documentation |
133 * generation. |
117 * generation. |
134 * |
118 * |
135 * @param classDoc the {@link ClassDoc} we want to check. |
119 * @param classDoc the {@link ClassDoc} we want to check. |
156 } |
140 } |
157 |
141 |
158 /** |
142 /** |
159 * Build the method documentation. |
143 * Build the method documentation. |
160 */ |
144 */ |
161 public void buildMethodDoc(List<?> elements) { |
145 public void buildMethodDoc(XMLNode node) { |
162 if (writer == null) { |
146 if (writer == null) { |
163 return; |
147 return; |
164 } |
148 } |
165 for (currentMethodIndex = 0; |
149 for (currentMethodIndex = 0; |
166 currentMethodIndex < methods.size(); |
150 currentMethodIndex < methods.size(); |
167 currentMethodIndex++) { |
151 currentMethodIndex++) { |
168 build(elements); |
152 buildChildren(node); |
169 } |
153 } |
170 } |
154 } |
171 |
155 |
172 /** |
156 /** |
173 * Build the overall header. |
157 * Build the overall header. |
174 */ |
158 */ |
175 public void buildHeader() { |
159 public void buildHeader(XMLNode node) { |
176 writer.writeHeader( |
160 writer.writeHeader( |
177 classDoc, |
161 classDoc, |
178 configuration.getText("doclet.Method_Detail")); |
162 configuration.getText("doclet.Method_Detail")); |
179 } |
163 } |
180 |
164 |
181 /** |
165 /** |
182 * Build the header for the individual method. |
166 * Build the header for the individual method. |
183 */ |
167 */ |
184 public void buildMethodHeader() { |
168 public void buildMethodHeader(XMLNode node) { |
185 writer.writeMethodHeader( |
169 writer.writeMethodHeader( |
186 (MethodDoc) methods.get(currentMethodIndex), |
170 (MethodDoc) methods.get(currentMethodIndex), |
187 currentMethodIndex == 0); |
171 currentMethodIndex == 0); |
188 } |
172 } |
189 |
173 |
190 /** |
174 /** |
191 * Build the signature. |
175 * Build the signature. |
192 */ |
176 */ |
193 public void buildSignature() { |
177 public void buildSignature(XMLNode node) { |
194 writer.writeSignature((MethodDoc) methods.get(currentMethodIndex)); |
178 writer.writeSignature((MethodDoc) methods.get(currentMethodIndex)); |
195 } |
179 } |
196 |
180 |
197 /** |
181 /** |
198 * Build the deprecation information. |
182 * Build the deprecation information. |
199 */ |
183 */ |
200 public void buildDeprecationInfo() { |
184 public void buildDeprecationInfo(XMLNode node) { |
201 writer.writeDeprecated((MethodDoc) methods.get(currentMethodIndex)); |
185 writer.writeDeprecated((MethodDoc) methods.get(currentMethodIndex)); |
202 } |
186 } |
203 |
187 |
204 /** |
188 /** |
205 * Build the comments for the method. Do nothing if |
189 * Build the comments for the method. Do nothing if |
206 * {@link Configuration#nocomment} is set to true. If this method |
190 * {@link Configuration#nocomment} is set to true. If this method |
207 */ |
191 */ |
208 public void buildMethodComments() { |
192 public void buildMethodComments(XMLNode node) { |
209 if (!configuration.nocomment) { |
193 if (!configuration.nocomment) { |
210 MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); |
194 MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); |
211 |
195 |
212 if (method.inlineTags().length == 0) { |
196 if (method.inlineTags().length == 0) { |
213 DocFinder.Output docs = DocFinder.search( |
197 DocFinder.Output docs = DocFinder.search( |
226 |
210 |
227 |
211 |
228 /** |
212 /** |
229 * Build the tag information. |
213 * Build the tag information. |
230 */ |
214 */ |
231 public void buildTagInfo() { |
215 public void buildTagInfo(XMLNode node) { |
232 writer.writeTags((MethodDoc) methods.get(currentMethodIndex)); |
216 writer.writeTags((MethodDoc) methods.get(currentMethodIndex)); |
233 } |
217 } |
234 |
218 |
235 /** |
219 /** |
236 * Build the footer of the method. |
220 * Build the footer of the method. |
237 */ |
221 */ |
238 public void buildMethodFooter() { |
222 public void buildMethodFooter(XMLNode node) { |
239 writer.writeMethodFooter(); |
223 writer.writeMethodFooter(); |
240 } |
224 } |
241 |
225 |
242 /** |
226 /** |
243 * Build the overall footer. |
227 * Build the overall footer. |
244 */ |
228 */ |
245 public void buildFooter() { |
229 public void buildFooter(XMLNode node) { |
246 writer.writeFooter(classDoc); |
230 writer.writeFooter(classDoc); |
247 } |
231 } |
248 |
232 |
249 /** |
233 /** |
250 * Return the method writer for this builder. |
234 * Return the method writer for this builder. |