package com.panchan.tsmese.utils; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; /** * @Description:TODO * @version 1.0 * @since JDK1.8 * @author * @Created on 2018年9月19日 */ public class FatherReflectUtils { /** * 获取父类的参数类型方法 * @param clazz * @param index * @return * @throws InstantiationException * @throws IllegalAccessException */ @SuppressWarnings("rawtypes") public static Class getSuperClassParamType(Class<?> clazz, int index) throws InstantiationException, IllegalAccessException { Type sType = clazz.getGenericSuperclass(); Type[] generics = ((ParameterizedType) sType).getActualTypeArguments(); Class<?> mClass = (Class<?>) (generics[index]); return mClass; } }