反射获取list属性⾥的类名List<Field> fieldList=new ArrayList<Field>();
for (Class<?> superClass = Class(); superClass != Object.class;
superClass = Superclass()) {
Field[] fields = DeclaredFields();
for (Field field : fields) {企业员工培训方案
王源的女朋友接吻图Class<?> fc = Type();
评论怎么附加图片if(fc.isPrimitive()){
System.out.println("基本数据类型: " + Name() + " " + fc.getName());
}else{
if(fc.isAssignableFrom(List.class)){ //判断是否为List
System.out.println("List类型:" + Name());
flect.Type gt = GenericType(); //得到泛型类型
ParameterizedType pt = (ParameterizedType)gt;龙之宇内至尊
Class<?> listClazz = (Class<?>)pt.getActualTypeArguments()[0];
System.out.println("\t\t" + Name());
}
}
fieldList.add(field);电脑连接WIFI显示无INTERNET
}
}
一望无际的反射获取list属性⾥的类名
发布评论