Here you can find the source of getGenericArgument(Field field, int index)
public static Class getGenericArgument(Field field, int index)
//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 getGenericArgument(Field field, int index) { final Class entryType; Type genericType = field.getGenericType(); if (genericType instanceof ParameterizedType) { Type[] typeArgs = ((ParameterizedType) genericType).getActualTypeArguments(); if (typeArgs != null && typeArgs.length > index) { if (typeArgs[index] instanceof Class) { entryType = (Class) typeArgs[index]; } else { entryType = Object.class; }/*from ww w . jav a 2 s. c o m*/ } else { entryType = Object.class; } } else { entryType = Object.class; } return entryType; } }