Here you can find the source of getGenerics(Class classType)
public static Class[] getGenerics(Class classType)
//package com.java2s; //License from project: Apache License import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { public static Class[] getGenerics(Class classType) { Type type = (Type) classType.getGenericSuperclass(); ParameterizedType pt = (ParameterizedType) type; Type[] types = pt.getActualTypeArguments(); if (types[0] instanceof Class) { Class[] classz = new Class[types.length]; for (int i = 0; i < classz.length; i++) { classz[i] = (Class) types[i]; }/*from ww w . j av a 2 s . c o m*/ return classz; } else { return null; } } }