
本文共 1717 字,大约阅读时间需要 5 分钟。
import java.lang.reflect.Field;/*** ���������������������������������������* * @param object* @return*/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.isEmpty(f.get(object).toString())) { return false; } } } catch (Exception e) { e.printStackTrace(); } return true;}
���������������������������������������������
java������������������������������maticaly���������������������������������������������������������������������checkObjAllFieldsIsNull
������������������������������������������������������������������������������������������������������������������
���������������������������������������������null
���������������������������true
���������������������������������
������������������������������������������������������������������������������������������������f.setAccessible(true)
������������������������������������������������������
������������������������������������������������������������������������������������������������null
���������������������������������������!StringUtils.isEmpty(f.get(object).toString())
���������������false
������������������������������
���������������������������������������������true
���
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
