根据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){

                }
            });
原文地址:https://www.cnblogs.com/qq376324789/p/13896877.html