ArneLimburg commented on a change in pull request #53: JOHNZON-282: add support 
for @JsonbTypeAdapter at class level
URL: https://github.com/apache/johnzon/pull/53#discussion_r328933677
 
 

 ##########
 File path: 
johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JsonbAccessMode.java
 ##########
 @@ -1033,6 +1037,20 @@ private boolean isNumberType(final Type type) {
         return Number.class.isAssignableFrom(clazz) || clazz.isPrimitive();
     }
 
+    private boolean hasRawType(final Type type) {
+        return Class.class.isInstance(type) || 
ParameterizedType.class.isInstance(type);
+    }
+
+    private Class<?> getRawType(final Type type) {
+        if (!Class.class.isInstance(type) && 
!ParameterizedType.class.isInstance(type)) {
+            throw new IllegalStateException("Unsupported generic type " + 
type.getClass().getName());
+        } else if (Class.class.isInstance(type)) {
+            return Class.class.cast(type);
+        } else /*if (ParameterizedType.class.isInstance(type))*/ {
+            return getRawType(ParameterizedType.class.cast(type).getRawType());
 
 Review comment:
   Thinking about it, it neither needs recursion nor a loop since getRawType() 
always returns a class object

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to