java反射机制判断对象所有属性是否全部为空

来源:互联网 发布:dnf网络出现异常09 编辑:程序博客网 时间:2024/05/20 16:33
private boolean checkObjFieldIsNotNull(Object obj){    try {        for (Field f : obj.getClass().getDeclaredFields()) {            f.setAccessible(true);            if (f.get(obj) != null) {                return true;            }        }    }catch (IllegalAccessException e){    }    return false;}
阅读全文
0 0
原创粉丝点击