Beispiel #1
0
 /**
  * Returns the arguments of the provided generic class or interface.
  *
  * @param type the class to search.
  * @param args the class arguments.
  * @param clazz the generic class or interface of interest.
  * @return the arguments of the generic class or interface, or <code>null</code> if not found.
  */
 protected static Type[] getTypeArguments(Class<?> type, Type[] args, Class<?> clazz) {
   if (type == clazz) {
     return args;
   }
   TypeVariable[] params = type.getTypeParameters();
   for (Type iface : type.getGenericInterfaces()) {
     Type[] result = getTypeArguments(iface, params, args, clazz);
     if (result != null) {
       return result;
     }
   }
   return getTypeArguments(type.getGenericSuperclass(), params, args, clazz);
 }