public class IsObjectEmpty {
public static HashMap<String,String> isObjectFiledEmpty(UserProfile.Diet object) throws Exception{
HashMap<String,String> map=new HashMap<>();
Class<?> clazz= object.getClass();
Field[] fs=clazz.getDeclaredFields();
for(Field field:fs){
field.setAccessible(true);
if(field.get(object)!=null){
String name=(String)field.getName();
map.put(name,field.get(object).toString());
}
}
return map;
}
}