You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/03/09 04:15:00 UTC

svn commit: r920637 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java

Author: dkulp
Date: Tue Mar  9 03:15:00 2010
New Revision: 920637

URL: http://svn.apache.org/viewvc?rev=920637&view=rev
Log:
[CXF-2698] Fix mapping to non-primitive types

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?rev=920637&r1=920636&r2=920637&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java Tue Mar  9 03:15:00 2010
@@ -223,7 +223,7 @@ public class URIMappingInterceptor exten
             if (type != null && type.isPrimitive() && queries.get(key) != null) {
                 param = PrimitiveUtils.read(queries.get(key), type);
             } else {
-                param = queries.get(key);
+                param = readType(queries.get(key), type);
             }
             parameters.set(idx, param);
             
@@ -231,7 +231,27 @@ public class URIMappingInterceptor exten
         }
         return parameters;
     }
-    
+    private Object readType(String value, Class<?> type) {
+        Object ret = value;
+        if (Integer.class == type) {
+            ret = Integer.valueOf(value);
+        } else if (Byte.class == type) {
+            ret = Byte.valueOf(value);
+        } else if (Short.class == type) {
+            ret = Short.valueOf(value);
+        } else if (Long.class == type) {
+            ret = Long.valueOf(value);
+        } else if (Float.class == type) {
+            ret = Float.valueOf(value);
+        } else if (Double.class == type) { 
+            ret = Double.valueOf(value);
+        } else if (Boolean.class == type) { 
+            ret = Boolean.valueOf(value);
+        } else if (Character.class == type) { 
+            ret = value.charAt(0); 
+        }
+        return ret;
+    }
     private String uriDecode(String query) {
         try {
             query = URLDecoder.decode(query, "UTF-8");