根据class对象判断是否为接口、根据class对象判断是否为抽象类
作者:互联网
Field[] fields = TbRawMaterialController.class.getDeclaredFields(); Arrays.stream(fields).forEach(field -> { String fieldName = field.getName(); Class<?> type = field.getType(); try { field.setAccessible(true); if(!Modifier.isAbstract(field.getModifiers())&&!type.isInterface()){ Object o = field.get(TbRawMaterialController.class); map.put(fieldName,o); } }catch (Exception e){ } });
标签:TbRawMaterialController,对象,fields,field,fieldName,抽象类,type,class 来源: https://blog.51cto.com/u_15242378/2847921