cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r787204 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
Date Mon, 22 Jun 2009 11:24:37 GMT
Author: sergeyb
Date: Mon Jun 22 11:24:36 2009
New Revision: 787204

URL: http://svn.apache.org/viewvc?rev=787204&view=rev
Log:
Merged revisions 787200 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r787200 | sergeyb | 2009-06-22 12:11:12 +0100 (Mon, 22 Jun 2009) | 1 line
  
  CXF-2303 : proper support for SortedSets
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 22 11:24:36 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786850
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786850,787200

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jun 22 11:24:36 2009
@@ -1 +1 @@
-/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784184,784893-785866,785932,786142,786271-786272,786395,786512,786514,786582-786583,786638,786850
+/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784184,784893-785866,785932,786142,786271-786272,786395,786512,786514,786582-786583,786638,786850,787200

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=787204&r1=787203&r2=787204&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Mon Jun 22 11:24:36 2009
@@ -519,7 +519,6 @@
     public static boolean isSupportedCollectionOrArray(Class<?> type) {
         return List.class.isAssignableFrom(type)
             || Set.class.isAssignableFrom(type)
-            || SortedSet.class.isAssignableFrom(type)
             || type.isArray();
     }
 
@@ -541,18 +540,25 @@
         }
     }
 
-    private static Object injectIntoCollectionOrArray(Class<?> rawType, Type genericType,
-                                        MultivaluedMap<String, String> values,
-                                        boolean isbean, boolean decoded,
-                                        ParameterType pathParam, Message message) {
+    
+    static Class<?> getCollectionType(Class<?> rawType) {
         Class<?> type = null;
         if (List.class.isAssignableFrom(rawType)) {
             type = ArrayList.class;
-        } else if (Set.class.isAssignableFrom(rawType)) {
-            type = HashSet.class;
         } else if (SortedSet.class.isAssignableFrom(rawType)) {
             type = TreeSet.class;
+        } else if (Set.class.isAssignableFrom(rawType)) {
+            type = HashSet.class;
         }
+        return type;
+        
+    }
+    
+    private static Object injectIntoCollectionOrArray(Class<?> rawType, Type genericType,
+                                        MultivaluedMap<String, String> values,
+                                        boolean isbean, boolean decoded,
+                                        ParameterType pathParam, Message message) {
+        Class<?> type = getCollectionType(rawType);
 
         Class<?> realType = InjectionUtils.getActualType(genericType);
         

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java?rev=787204&r1=787203&r2=787204&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
Mon Jun 22 11:24:36 2009
@@ -19,7 +19,12 @@
 package org.apache.cxf.jaxrs.utils;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
 
 import javax.ws.rs.core.MultivaluedMap;
 
@@ -28,6 +33,27 @@
 
 public class InjectionUtilsTest extends Assert {
     
+    public void testCollectionTypeFromArray() {
+        assertNull(InjectionUtils.getCollectionType(String[].class));
+    }
+    
+    @Test
+    public void testCollectionType() {
+        assertEquals(ArrayList.class, InjectionUtils.getCollectionType(List.class));
+        assertEquals(HashSet.class, InjectionUtils.getCollectionType(Set.class));
+        assertEquals(TreeSet.class, InjectionUtils.getCollectionType(SortedSet.class));
+    }
+    
+    @Test
+    public void testSupportedCollectionType() {
+        assertFalse(InjectionUtils.isSupportedCollectionOrArray(Map.class));
+        assertTrue(InjectionUtils.isSupportedCollectionOrArray(String[].class));
+        assertTrue(InjectionUtils.isSupportedCollectionOrArray(List.class));
+        assertTrue(InjectionUtils.isSupportedCollectionOrArray(Set.class));
+        assertTrue(InjectionUtils.isSupportedCollectionOrArray(SortedSet.class));
+    }
+    
+    
     @Test
     public void testExtractValuesFromBean() {
         CustomerBean1 bean1 = new CustomerBean1();



Mime
View raw message