< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java

Print this page

        

@@ -34,11 +34,10 @@
 import javax.lang.model.type.TypeMirror;
 
 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
 import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
 import jdk.javadoc.internal.doclets.formats.html.markup.Table;
 import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
 import jdk.javadoc.internal.doclets.toolkit.Content;

@@ -138,27 +137,15 @@
      * @param method the method being documented.
      * @return a content object for the signature
      */
     @Override
     public Content getSignature(ExecutableElement method) {
-        HtmlTree pre = new HtmlTree(HtmlTag.PRE);
-        pre.setStyle(HtmlStyle.methodSignature);
-        writer.addAnnotationInfo(method, pre);
-        int annotationLength = pre.charCount();
-        addModifiers(method, pre);
-        addTypeParameters(method, pre);
-        addReturnType(method, pre);
-        if (configuration.linksource) {
-            Content methodName = new StringContent(name(method));
-            writer.addSrcLink(method, methodName, pre);
-        } else {
-            addName(name(method), pre);
-        }
-        int indent = pre.charCount() - annotationLength;
-        addParameters(method, pre, indent);
-        addExceptions(method, pre, indent);
-        return pre;
+        MemberSignature sig = new MemberSignature(method);
+        sig.addTypeParametersAndReturnType(getTypeParameters(method), getReturnType(method));
+        sig.addName(method);
+        sig.addParametersAndExceptions(getParameters(method, true), getExceptions(method));
+        return sig.toContent();
     }
 
     /**
      * {@inheritDoc}
      */

@@ -397,23 +384,21 @@
             dl.add(dd);
         }
     }
 
     /**
-     * Add the return type.
+     * Get the return type for the given method.
      *
      * @param method the method being documented.
-     * @param htmltree the content tree to which the return type will be added
+     * @return content containing the return type
      */
-    protected void addReturnType(ExecutableElement method, Content htmltree) {
+    protected Content getReturnType(ExecutableElement method) {
         TypeMirror type = utils.getReturnType(method);
         if (type != null) {
-            Content linkContent = writer.getLink(
-                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
-            htmltree.add(linkContent);
-            htmltree.add(Entity.NO_BREAK_SPACE);
+            return writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
         }
+        return new ContentBuilder();
     }
 
     @Override
     public Content getMemberTreeHeader(){
         return writer.getMemberTreeHeader();
< prev index next >