Here you can find the source of getGenericTypes(Class> clazz)
public static Type[] getGenericTypes(Class<?> clazz)
//package com.java2s; //License from project: Apache License import java.lang.reflect.*; public class Main { public static Type[] getGenericTypes(Class<?> clazz) { Class<?> myClass = clazz; if (!(clazz.getGenericSuperclass() instanceof ParameterizedType)) { myClass = clazz.getSuperclass(); }//from w w w .j a va2 s.c o m Type superClass = myClass.getGenericSuperclass(); ParameterizedType type = (ParameterizedType) superClass; return type.getActualTypeArguments(); } }