Here you can find the source of getGenericType(Type t, int index)
public static Class getGenericType(Type t, int index)
//package com.java2s; /************************************************************************************** * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * **************************************************************************************/ import java.lang.reflect.*; public class Main { public static Class getGenericType(Type t, int index) { if (t == null) { return null; }//from w w w . j a v a2 s . com if (!(t instanceof ParameterizedType)) { return null; } ParameterizedType ptype = (ParameterizedType) t; if ((ptype.getActualTypeArguments() == null) || (ptype.getActualTypeArguments().length < (index + 1))) { return Object.class; } Type typeParam = ptype.getActualTypeArguments()[index]; if (!(typeParam instanceof Class)) { return Object.class; } return (Class) typeParam; } }