Here you can find the source of getGenericClass(Class> clazz, int index)
@SuppressWarnings("unchecked") public static <T> Class<T> getGenericClass(Class<?> clazz, int index)
//package com.java2s; /*//from w ww.j av a 2 s . c om * ReflectionUtils.java * * Copyright (c) 1998 - 2005 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium ERP system. * */ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public class Main { @SuppressWarnings("unchecked") public static <T> Class<T> getGenericClass(Class<?> clazz, int index) { Type[] actualTypeArguments = ((ParameterizedType) clazz.getGenericSuperclass()).getActualTypeArguments(); if (actualTypeArguments.length < index) throw new IndexOutOfBoundsException(); return (Class<T>) actualTypeArguments[index]; } }