Type[] pts = method.getGenericParameterTypes();
for( Type t :pts){
if(((Class)t).isEnum()){
Method method1 = ((Class) t).getMethod("valueOf",String.class);
Object o = method1.invoke(null,str);
aps[i] = o;
}
}
Type[] pts = method.getGenericParameterTypes();
for( Type t :pts){
if(((Class)t).isEnum()){
Method method1 = ((Class) t).getMethod("valueOf",String.class);
Object o = method1.invoke(null,str);
aps[i] = o;
}
}
本文标题:反射生成枚举
本文链接:https://www.haomeiwen.com/subject/iwogpftx.html
网友评论