Here you can find the source of getGenericClass(Class> clazz)
public static Class<?> getGenericClass(Class<?> clazz)
//package com.java2s; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { public static Class<?> getGenericClass(Class<?> clazz) { Type t = clazz.getGenericSuperclass(); if (t instanceof ParameterizedType) { Type[] p = ((ParameterizedType) t).getActualTypeArguments(); return ((Class<?>) p[0]); }/*from w ww . j a v a 2s .c o m*/ return null; } }