Method m = null;
try {
m = ReflectionClass.class.getMethod("test", Map.class, List.class);
Type[] mType = m.getGenericParameterTypes();
for(Type t : mType){
for(Type p :((ParameterizedType)t).getActualTypeArguments()){
System.out.println(p);
}
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
反射中获取泛型参数信息
最新推荐文章于 2024-06-30 14:07:19 发布