利用反射判断bean属性不为空(null和空串)
/** * @param object * @Description 判断是否位空对象 * @Author vioking * @Date 18-12-26 下午12:12 * @Return boolean */ private boolean isNotNullObject(Object object) throws IllegalAccessException { if (null == object) { return false; } Field[] fields = object.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); Object obj = field.get(object); if (null != obj && !"".equals(obj)) { return true; } } return false; }