Here you can find the source of getGenericClass(final Class> class1)
private static Class<?> getGenericClass(final Class<?> class1)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { private static Class<?> getGenericClass(final Class<?> class1) { final Type type = class1.getGenericSuperclass(); return getGenericClass(type); }//from ww w . j a va2 s . c o m private static Class<?> getGenericClass(final Type type) { Class<?> result = null; if (type instanceof ParameterizedType) { final ParameterizedType pt = (ParameterizedType) type; final Type[] fieldArgTypes = pt.getActualTypeArguments(); result = (Class<?>) fieldArgTypes[0]; } return result; } }