• 利用反射判断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;
    }
  • 相关阅读:
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    iOS
    ajax 几种提交方式
  • 原文地址:https://www.cnblogs.com/ViokingJava/p/10179018.html
Copyright © 2020-2023  润新知