Here you can find the source of getGenericParameters(Class> clazz)
public static Class<?>[] getGenericParameters(Class<?> clazz)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { public static Class<?>[] getGenericParameters(Class<?> clazz) { return getGenericParametersInternal(clazz.getGenericSuperclass()); }/*from www . j a v a 2 s . co m*/ public static Class<?>[] getGenericParameters(Field field) { return getGenericParametersInternal(field.getGenericType()); } private static Class<?>[] getGenericParametersInternal(Type genericFieldType) { if (genericFieldType instanceof ParameterizedType) { ParameterizedType aType = (ParameterizedType) genericFieldType; Type[] fieldArgTypes = aType.getActualTypeArguments(); Class<?>[] clazzes = new Class<?>[fieldArgTypes.length]; for (int i = 0; i < clazzes.length; i++) { clazzes[i] = (Class<?>) fieldArgTypes[i]; } return clazzes; } return new Class<?>[] {}; } }