コード例 #1
0
 /**
  * Queries recursively the supertypes of {@link RegisteredType} to see whether it inherits from
  * the given {@link RegisteredType}
  */
 public static boolean isSubtypeOf(RegisteredType type, RegisteredType superType) {
   if (type.equals(superType)) return true;
   for (Object st : type.getSuperTypes()) {
     if (st instanceof RegisteredType) {
       if (isSubtypeOf((RegisteredType) st, superType)) return true;
     }
   }
   return false;
 }
コード例 #2
0
 /** Checks whether the given object appears to be an instance of the given registered type */
 private static boolean isSubtypeOf(Class<?> candidate, RegisteredType type) {
   for (Object st : type.getSuperTypes()) {
     if (st instanceof RegisteredType) {
       if (!isSubtypeOf(candidate, (RegisteredType) st)) return false;
     }
     if (st instanceof Class) {
       if (!((Class<?>) st).isAssignableFrom(candidate)) return false;
     }
   }
   return true;
 }
コード例 #3
0
 /**
  * Queries recursively the supertypes of {@link RegisteredType} to see whether it inherits from
  * the given {@link Class}
  */
 public static boolean isSubtypeOf(RegisteredType type, Class<?> superType) {
   return isAnyTypeSubtypeOf(type.getSuperTypes(), superType);
 }