cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1128145 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ tools/common/src/main/java/org/apache/cxf/tools/common/model/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/
Date Fri, 27 May 2011 02:51:40 GMT
Author: dkulp
Date: Fri May 27 02:51:39 2011
New Revision: 1128145

URL: http://svn.apache.org/viewvc?rev=1128145&view=rev
Log:
Format the generate javadoc a lot nicer.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaPort.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaServiceClass.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Fri May
27 02:51:39 2011
@@ -145,7 +145,7 @@ public class WSDLServiceBuilder {
     
     private void copyDocumentation(AbstractPropertiesHolder info, WSDLElement el) {
         if (el.getDocumentationElement() != null) {
-            String doc = DOMUtils.getContent(el.getDocumentationElement());
+            String doc = DOMUtils.getRawContent(el.getDocumentationElement());
             info.setDocumentation(doc);
         }
     }

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaInterface.java
Fri May 27 02:51:39 2011
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.tools.common.model;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
 import java.util.*;
 import javax.jws.soap.SOAPBinding;
 
@@ -48,11 +51,48 @@ public class JavaInterface implements Ja
       
     public JavaInterface() {
     }
-    
     public JavaInterface(JavaModel m) {
         this.model = m;
     }
 
+    
+    static String formatJavaDoc(String d, String spaces) {
+        if (d != null) {
+            StringBuilder d2 = new StringBuilder(d.length());
+            StringReader r = new StringReader(d);
+            BufferedReader r2 = new BufferedReader(r);
+            try {
+                String s2 = r2.readLine();
+                String pfx = null;
+                while (s2 != null) {
+                    if (pfx == null && s2.length() > 0) {
+                        pfx = "";
+                        while (s2.length() > 0 && Character.isWhitespace(s2.charAt(0)))
{
+                            pfx += " ";
+                            s2 = s2.substring(1);
+                        }
+                    }
+                    if (pfx != null) {
+                        if (d2.length() > 0) {
+                            d2.append("\n");
+                        }
+                        d2.append(spaces).append("* ");
+                        if (s2.startsWith(pfx)) {
+                            d2.append(s2.substring(pfx.length()));
+                        } else {
+                            d2.append(s2);
+                        }
+                    }
+                    s2 = r2.readLine();
+                }
+                d = d2.toString();
+            } catch (IOException ex) {
+                //ignore, use the raw value
+            }
+        }
+        return d;
+    }
+    
     public void setWebServiceName(String wsn) {
         this.webserviceName = wsn;
     }
@@ -171,7 +211,7 @@ public class JavaInterface implements Ja
     }
     
     public void setPackageJavaDoc(String doc) {
-        packageJavaDoc = doc;
+        packageJavaDoc = formatJavaDoc(doc, " ");
     }
     
     public String getPackageJavaDoc() {   
@@ -179,7 +219,7 @@ public class JavaInterface implements Ja
     }
     
     public void setClassJavaDoc(String doc) {
-        classJavaDoc = doc;
+        classJavaDoc = formatJavaDoc(doc, " ");
     }
     
     public String getClassJavaDoc() {   

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaMethod.java
Fri May 27 02:51:39 2011
@@ -385,7 +385,7 @@ public class JavaMethod implements JavaA
     }
     
     public void setJavaDoc(String doc) {
-        javaDoc = doc;
+        javaDoc = JavaInterface.formatJavaDoc(doc, "     ");
     }
     
     public String getJavaDoc() {

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaPort.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaPort.java?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaPort.java (original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaPort.java Fri
May 27 02:51:39 2011
@@ -46,7 +46,7 @@ public class JavaPort {
     }
 
     public void setJavaDoc(String d) {
-        javadoc = d;
+        javadoc = JavaInterface.formatJavaDoc(d, "     ");
     }
     public String getJavaDoc() {
         return javadoc == null ? "" : javadoc;

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaServiceClass.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaServiceClass.java?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaServiceClass.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaServiceClass.java
Fri May 27 02:51:39 2011
@@ -27,8 +27,6 @@ public class JavaServiceClass extends Ja
     private final List<JavaPort> ports = new ArrayList<JavaPort>();
   
     private String serviceName;
-    private String classJavaDoc;
-    private String packageJavaDoc;
     
     public JavaServiceClass(JavaModel model) {
         super(model);
@@ -49,21 +47,4 @@ public class JavaServiceClass extends Ja
     public String getServiceName() {
         return serviceName;
     }
-    
-    public void setPackageJavaDoc(String doc) {
-        packageJavaDoc = doc;
-    }
-    
-    public String getPackageJavaDoc() {   
-        return (packageJavaDoc != null) ? packageJavaDoc : "";
-    }
-    
-    public void setClassJavaDoc(String doc) {
-        classJavaDoc = doc;
-    }
-    
-    public String getClassJavaDoc() {   
-        return (classJavaDoc != null) ? classJavaDoc : "";
-    } 
-
 }

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/fault.vm
Fri May 27 02:51:39 2011
@@ -25,7 +25,7 @@ import javax.xml.ws.WebFault;
 
 /**
 #if ($expClass.classJavaDoc != "")
- * $expClass.classJavaDoc
+$expClass.classJavaDoc
  *
 #end   
  * This class was generated by $fullversion

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/sei.vm
Fri May 27 02:51:39 2011
@@ -16,7 +16,7 @@
 ## under the License.
 #if ($intf.packageJavaDoc != "")
 /**
- * $intf.packageJavaDoc
+$intf.packageJavaDoc
  */
 #end
 package $intf.PackageName;
@@ -30,7 +30,7 @@ import ${import};
 
 /**
 #if ($intf.classJavaDoc != "")
- * $intf.classJavaDoc
+$intf.classJavaDoc
  *
 #end
  * This class was generated by $fullversion
@@ -49,7 +49,7 @@ public interface $intf.Name {
 
 #if ($method.JavaDoc != "")
     /**
-     * ${method.JavaDoc}
+${method.JavaDoc}
      */
 #end
 #foreach ($annotation in $method.Annotations)

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm?rev=1128145&r1=1128144&r2=1128145&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/service.vm
Fri May 27 02:51:39 2011
@@ -14,11 +14,11 @@
 ## KIND, either express or implied. See the License for the
 ## specific language governing permissions and limitations
 ## under the License.
-
+#if ($service.packageJavaDoc != "")
 /*
- * $service.packageJavaDoc
+$service.packageJavaDoc
  */
-
+#end
 package $service.PackageName;
 
 import java.net.MalformedURLException;
@@ -36,7 +36,7 @@ import ${import};
 
 /**
 #if ($service.classJavaDoc != "")
- * $service.classJavaDoc
+$service.classJavaDoc
  *
 #end
  * This class was generated by $fullversion
@@ -163,7 +163,7 @@ public class ${service.Name} extends ${s
 #end
     /**
 #if ($port.javaDoc != "")
-     * $port.javaDoc
+$port.javaDoc
 #end
      *
      * @return
@@ -179,7 +179,7 @@ public class ${service.Name} extends ${s
 
     /**
 #if ($port.javaDoc != "")
-     * $port.javaDoc
+$port.javaDoc
 #end
      * 
      * @param features



Mime
View raw message