public static Map<String, String> convert(Object object) throws Exception {
Map<String, String> map = new HashMap<>();
Class<?> clazz = object.getClass();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String value = field.get(object) != null ? field.get(object).toString() : "";
map.put(field.getName(), value);
}
return map;
}
public static boolean checkObjAllFieldsIsNull(Object object) {
if (null == object) {
return true;
}
try {
for (Field f : object.getClass().getDeclaredFields()) {
f.setAccessible(true);
if (f.get(object) != null && StringUtils.isNotBlank(f.get(object).toString())) {
return false;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
}