Here you can find the source of getGenericsClass(Class cls)
public static Class getGenericsClass(Class cls) throws Exception
//package com.java2s; //License from project: Apache License import java.lang.reflect.ParameterizedType; public class Main { public static Class getGenericsClass(Class cls) throws Exception { ParameterizedType superClass = (ParameterizedType) cls.getGenericSuperclass(); Class target = (Class) superClass.getActualTypeArguments()[0]; return target; }//w w w.j a v a2 s . c om }