cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1292792 - in /cxf/trunk/rt/frontend/jaxrs/src: main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Date Thu, 23 Feb 2012 13:20:34 GMT
Author: sergeyb
Date: Thu Feb 23 13:20:33 2012
New Revision: 1292792

URL: http://svn.apache.org/viewvc?rev=1292792&view=rev
Log:
[CXF-4125] Updating WADLGenerator to keep the list of processed complex bean properties

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1292792&r1=1292791&r2=1292792&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Thu Feb 23 13:20:33 2012
@@ -572,12 +572,18 @@ public class WadlGenerator implements Re
                          pm.getName(), method.getParameterAnnotations()[pm.getIndex()],
                          isJson);
         } else {
-            doWriteBeanParam(sb, type, pm, null, isJson);
+            List<Class<?>> parentBeanClasses = new LinkedList<Class<?>>();
+            parentBeanClasses.add(type);
+            doWriteBeanParam(sb, type, pm, null, parentBeanClasses, isJson);
         }
     }
 
-    private void doWriteBeanParam(StringBuilder sb, Class<?> type, Parameter pm, String
parentName, 
-            boolean isJson) {
+    private void doWriteBeanParam(StringBuilder sb, 
+                                  Class<?> type, 
+                                  Parameter pm, 
+                                  String parentName,
+                                  List<Class<?>> parentBeanClasses,
+                                  boolean isJson) {
         Map<Parameter, Class<?>> pms = InjectionUtils.getParametersFromBeanClass(type,
pm.getType(), true);
         for (Map.Entry<Parameter, Class<?>> entry : pms.entrySet()) {
             String name = entry.getKey().getName();
@@ -588,8 +594,9 @@ public class WadlGenerator implements Re
             boolean isPrimitive = InjectionUtils.isPrimitive(paramCls) || paramCls.isEnum();
             if (isPrimitive || InjectionUtils.isSupportedCollectionOrArray(paramCls)) {
                 doWriteParam(sb, entry.getKey(), paramCls, paramCls, name, new Annotation[]{},
isJson);
-            } else {
-                doWriteBeanParam(sb, paramCls, entry.getKey(), name, isJson);
+            } else if (!parentBeanClasses.contains(paramCls)) {
+                parentBeanClasses.add(paramCls);
+                doWriteBeanParam(sb, paramCls, entry.getKey(), name, parentBeanClasses, isJson);
             }
         }
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=1292792&r1=1292791&r2=1292792&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Thu Feb 23 13:20:33 2012
@@ -191,6 +191,9 @@ public class BookStore {
             return bean;
         }
         
+        public QueryBean2 getIt() {
+            return this;
+        }
     }
     
     public static class QueryBean3 {



Mime
View raw message