34 import javax.lang.model.type.TypeMirror; |
34 import javax.lang.model.type.TypeMirror; |
35 |
35 |
36 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
36 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
37 import jdk.javadoc.internal.doclets.formats.html.markup.Entity; |
37 import jdk.javadoc.internal.doclets.formats.html.markup.Entity; |
38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
38 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
|
40 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
39 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
41 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
40 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
42 import jdk.javadoc.internal.doclets.formats.html.markup.Table; |
41 import jdk.javadoc.internal.doclets.formats.html.markup.Table; |
43 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
42 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader; |
44 import jdk.javadoc.internal.doclets.toolkit.Content; |
43 import jdk.javadoc.internal.doclets.toolkit.Content; |
138 * @param method the method being documented. |
137 * @param method the method being documented. |
139 * @return a content object for the signature |
138 * @return a content object for the signature |
140 */ |
139 */ |
141 @Override |
140 @Override |
142 public Content getSignature(ExecutableElement method) { |
141 public Content getSignature(ExecutableElement method) { |
143 HtmlTree pre = new HtmlTree(HtmlTag.PRE); |
142 return new MemberSignature(method) |
144 pre.setStyle(HtmlStyle.methodSignature); |
143 .addTypeParameters(getTypeParameters(method)) |
145 writer.addAnnotationInfo(method, pre); |
144 .addReturnType(getReturnType(method)) |
146 int annotationLength = pre.charCount(); |
145 .addParameters(getParameters(method, true)) |
147 addModifiers(method, pre); |
146 .addExceptions(getExceptions(method)) |
148 addTypeParameters(method, pre); |
147 .toContent(); |
149 addReturnType(method, pre); |
|
150 if (configuration.linksource) { |
|
151 Content methodName = new StringContent(name(method)); |
|
152 writer.addSrcLink(method, methodName, pre); |
|
153 } else { |
|
154 addName(name(method), pre); |
|
155 } |
|
156 int indent = pre.charCount() - annotationLength; |
|
157 addParameters(method, pre, indent); |
|
158 addExceptions(method, pre, indent); |
|
159 return pre; |
|
160 } |
148 } |
161 |
149 |
162 /** |
150 /** |
163 * {@inheritDoc} |
151 * {@inheritDoc} |
164 */ |
152 */ |
397 dl.add(dd); |
385 dl.add(dd); |
398 } |
386 } |
399 } |
387 } |
400 |
388 |
401 /** |
389 /** |
402 * Add the return type. |
390 * Get the return type for the given method. |
403 * |
391 * |
404 * @param method the method being documented. |
392 * @param method the method being documented. |
405 * @param htmltree the content tree to which the return type will be added |
393 * @return content containing the return type |
406 */ |
394 */ |
407 protected void addReturnType(ExecutableElement method, Content htmltree) { |
395 protected Content getReturnType(ExecutableElement method) { |
408 TypeMirror type = utils.getReturnType(method); |
396 TypeMirror type = utils.getReturnType(method); |
409 if (type != null) { |
397 if (type != null) { |
410 Content linkContent = writer.getLink( |
398 return writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type)); |
411 new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type)); |
399 } |
412 htmltree.add(linkContent); |
400 return new ContentBuilder(); |
413 htmltree.add(Entity.NO_BREAK_SPACE); |
|
414 } |
|
415 } |
401 } |
416 |
402 |
417 @Override |
403 @Override |
418 public Content getMemberTreeHeader(){ |
404 public Content getMemberTreeHeader(){ |
419 return writer.getMemberTreeHeader(); |
405 return writer.getMemberTreeHeader(); |