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

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;
}