public boolean isObjectFieldEmpty(Object object) {
boolean flag = false;
if (object != null) {
Class<?> entity = object.getClass();
Field[] fields = entity.getDeclaredFields();//获取该类的所有成员变量(私有的)
for (Field field : fields) {
try {
field.setAccessible(true);//成员变量为private,必须为true 否则抛出异常
if (field.get(object) != null && !"".equals(field.get(object))) {
flag = true;
break;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return flag;
}