cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] cxf git commit: Fixing a checkstyle error
Date Fri, 17 Jul 2015 17:57:10 GMT
Repository: cxf
Updated Branches:
  refs/heads/master b0b51cf57 -> 903c81fec


Fixing a checkstyle error


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

Branch: refs/heads/master
Commit: 408f5e3f4fea3182177c3ceddb9b48765dd9175b
Parents: 17f140e
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jul 17 20:56:33 2015 +0300
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jul 17 20:56:33 2015 +0300

----------------------------------------------------------------------
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java | 49 ++++++++++++--------
 1 file changed, 29 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/408f5e3f/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 de82530..a210726 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
@@ -779,26 +779,7 @@ public class SourceGenerator {
                 }
                 sbCode.append(genMethodName.replace("-", ""));
             } else {
-                boolean expandedQName = id.startsWith("{");
-                QName qname = convertToQName(id, expandedQName);
-                String packageName = possiblyConvertNamespaceURI(qname.getNamespaceURI(),
expandedQName);
-                
-                String clsFullName = getSchemaClassName(packageName, info.getGrammarInfo(),

-                        qname.getLocalPart(), info.getTypeClassNames());
-                int lastDotIndex = clsFullName == null ? -1 : clsFullName.lastIndexOf(".");
-                String localName = clsFullName == null 
-                    ? getClassName(qname.getLocalPart(), true, info.getTypeClassNames())

-                    : clsFullName.substring(lastDotIndex + 1);
-                String subResponseNs = clsFullName == null ? getClassPackageName(packageName)

-                    : clsFullName.substring(0, lastDotIndex);
-                Object parentNode = resourceEl.getParentNode();
-                String parentId = parentNode instanceof Element 
-                    ? ((Element)parentNode).getAttribute("id")
-                    : ""; 
-                writeSubResponseType(id.equals(parentId), subResponseNs, localName, 
-                        sbCode, imports);
-                
-                sbCode.append("get" + localName + suffixName);
+                writeSubresourceMethod(resourceEl, imports, sbCode, info, id, suffixName);
             }
             
             sbCode.append("(");
@@ -819,6 +800,34 @@ public class SourceGenerator {
         }
     }
     
+    private void writeSubresourceMethod(Element resourceEl,
+                                        Set<String> imports,
+                                        StringBuilder sbCode,
+                                        ContextInfo info,
+                                        String id,
+                                        String suffixName) {
+        boolean expandedQName = id.startsWith("{");
+        QName qname = convertToQName(id, expandedQName);
+        String packageName = possiblyConvertNamespaceURI(qname.getNamespaceURI(), expandedQName);
+        
+        String clsFullName = getSchemaClassName(packageName, info.getGrammarInfo(), 
+                qname.getLocalPart(), info.getTypeClassNames());
+        int lastDotIndex = clsFullName == null ? -1 : clsFullName.lastIndexOf(".");
+        String localName = clsFullName == null 
+            ? getClassName(qname.getLocalPart(), true, info.getTypeClassNames()) 
+            : clsFullName.substring(lastDotIndex + 1);
+        String subResponseNs = clsFullName == null ? getClassPackageName(packageName) 
+            : clsFullName.substring(0, lastDotIndex);
+        Object parentNode = resourceEl.getParentNode();
+        String parentId = parentNode instanceof Element 
+            ? ((Element)parentNode).getAttribute("id")
+            : ""; 
+        writeSubResponseType(id.equals(parentId), subResponseNs, localName, 
+                sbCode, imports);
+        
+        sbCode.append("get" + localName + suffixName);
+    }
+    
     private static boolean isMethodMatched(Set<String> methodNames, String methodNameLowerCase,
String id) {
         if (methodNames.isEmpty()) {
             return false;


Mime
View raw message