public static <T> Class<T> getSingleParameterTypeExtending(Class<?> clazz) {
Type t = clazz.getGenericSuperclass();
+ while (t instanceof Class<?>) {
+ Class<?> cl = (Class) t;
+ t = cl.getGenericSuperclass();
+ if (t == null) {
+ // according to javadoc, we have reached java.lang.Object so no can do
+ break;
+ }
+ }
if(t instanceof Class<?>) {
throw new UnsupportedOperationException("Missing parameter type for input class '" + clazz.getCanonicalName() + "'");
} else if (t instanceof ParameterizedType) {