Here you can find the source of getGenericParameterClass(Field field)
public static Class getGenericParameterClass(Field field)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { public static Class getGenericParameterClass(Field field) { if (!hasGenericParameter(field)) { return null; }/*www . j a v a2s.c o m*/ Type genericType = field.getGenericType(); return (Class) ((ParameterizedType) genericType).getActualTypeArguments()[0]; } private static boolean hasGenericParameter(Field field) { return field.getGenericType() instanceof ParameterizedType; } }