cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r926220 - /cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java
Date Mon, 22 Mar 2010 17:45:15 GMT
Author: bluk
Date: Mon Mar 22 17:45:14 2010
New Revision: 926220

URL: http://svn.apache.org/viewvc?rev=926220&view=rev
Log:
Update GenericEntity to check other possible types

Modified:
    cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java

Modified: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java?rev=926220&r1=926219&r2=926220&view=diff
==============================================================================
--- cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java
(original)
+++ cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/GenericEntity.java
Mon Mar 22 17:45:14 2010
@@ -19,6 +19,7 @@
 
 package javax.ws.rs.core;
 
+import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
@@ -57,6 +58,15 @@ public class GenericEntity<T> {
             if (!((Class<?>)genericType).isAssignableFrom(rawType)) {
                 throw new IllegalArgumentException();
             }
+        } else if (genericType instanceof ParameterizedType) {
+            checkCompatibility(rawType, ((ParameterizedType)genericType).getRawType());
+        } else if (genericType instanceof GenericArrayType) {
+            if (!rawType.isArray()) {
+                throw new IllegalArgumentException();
+            }
+            // check the array parameter
+            checkCompatibility(rawType.getComponentType(), ((GenericArrayType)genericType)
+                .getGenericComponentType());
         }
     }
 



Mime
View raw message