cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5608] Parameter names shoul always start from a lower case char
Date Wed, 12 Mar 2014 16:09:40 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 1ffad3dd6 -> f2284040e


[CXF-5608] Parameter names shoul always start from a lower case char


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f2284040
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f2284040
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f2284040

Branch: refs/heads/master
Commit: f2284040e8269ae8fe4cabe54b1b916abd26016d
Parents: 1ffad3d
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Mar 12 16:09:26 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Mar 12 16:09:26 2014 +0000

----------------------------------------------------------------------
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java   | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f2284040/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
----------------------------------------------------------------------
diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
index 57a6ec1..4082163 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
@@ -537,12 +537,22 @@ public class SourceGenerator {
     }
     
     private String firstCharToUpperCase(String name) {
-        StringBuilder sb = new StringBuilder();
-        if (name.length() > 0) {
+        if (name.length() > 0 && Character.isLowerCase(name.charAt(0))) {
+            StringBuilder sb = new StringBuilder();
             sb.append(Character.toUpperCase(name.charAt(0)));
             return name.length() > 1 ? sb.append(name.substring(1)).toString() : sb.toString();
         } else {
-            return sb.toString();
+            return name;
+        }
+    }
+    
+    private String firstCharToLowerCase(String name) {
+        if (name.length() > 0 && Character.isUpperCase(name.charAt(0))) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(Character.toLowerCase(name.charAt(0)));
+            return name.length() > 1 ? sb.append(name.substring(1)).toString() : sb.toString();
+        } else {
+            return name;
         }
     }
     
@@ -966,7 +976,7 @@ public class SourceGenerator {
             } else {
                 paramName = name.replaceAll("[:\\.\\-]", "_");
             }
-            sbCode.append(type).append(" ").append(paramName);
+            sbCode.append(type).append(" ").append(firstCharToLowerCase(paramName));
             if (i + 1 < inParamEls.size()) {
                 sbCode.append(", ");
                 if (i + 1 >= 4 && ((i + 1) % 4) == 0) {


Mime
View raw message