Search in sources :

Example 1 with Validate

use of org.eweb4j.mvc.validator.annotation.Validate in project eweb4j-framework by laiweiwei.

the class ActionAnnotationConfig method parseValidators.

private static List<ValidatorConfigBean> parseValidators(ReflectUtil ru, Method m) {
    List<ValidatorConfigBean> vals = new ArrayList<ValidatorConfigBean>();
    // 读取@Validate注解,拿到需要被验证的参数名称
    Validate validate = m.getAnnotation(Validate.class);
    if (validate == null)
        return vals;
    String[] fields = validate.value();
    String[] excepts = validate.except();
    if (fields != null) {
        // 读取Action object 的属性 验证信息
        List<ValidatorConfigBean> fieldVal = ValidatorUtil.readValidator(fields, excepts, null, ru, null, null);
        if (fieldVal != null)
            vals.addAll(fieldVal);
    }
    return vals;
}
Also used : ValidatorConfigBean(org.eweb4j.mvc.config.bean.ValidatorConfigBean) Validate(org.eweb4j.mvc.validator.annotation.Validate) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 ValidatorConfigBean (org.eweb4j.mvc.config.bean.ValidatorConfigBean)1 Validate (org.eweb4j.mvc.validator.annotation.Validate)1