leap.core.validation.Validation.stateValidate()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中leap.core.validation.Validation.stateValidate()方法的一些代码示例,展示了Validation.stateValidate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validation.stateValidate()方法的具体详情如下:
包路径:leap.core.validation.Validation
类名称:Validation
方法名:stateValidate

Validation.stateValidate介绍

[英]Returns false if the validation not passed.
[中]如果验证未通过,则返回false

代码示例

代码示例来源:origin: org.leapframework/leap-orm

@Override
public boolean validate(EntityWrapper entity, FieldMapping fm, Object value, Validation validation, int maxErrors) {
  return validation.stateValidate(fm.getFieldName(), value, validator);
}

代码示例来源:origin: org.leapframework/leap-orm

protected boolean validateField(EntityWrapper entity,Validation validation,int maxErrors,FieldMapping fm,Validator validator,Object value){
  return validation.stateValidate(fm.getFieldName(),value,validator);
}

代码示例来源:origin: org.leapframework/leap-core

@Override
public boolean stateValidate(String name, Object bean) {
  Validation v = createNewValidation(name);
  
  if(!v.stateValidate(bean)){
    addErrors(v.errors());
    return false;
  }
  
  return true;
}

代码示例来源:origin: org.leapframework/leap-core

protected boolean validateProperty(String name, Object bean, Validation validation, int maxErrors, ValidatedProperty vp){
  BeanProperty p = vp.property;
  Object v = p.getValue(bean);
  
  boolean pass = true;
  boolean validateBean = false;
  String fullPropertyName = (Strings.isEmpty(name) ? "" : name + ".") + p.getName();
  //Validated by validators
  for(int i=0;i<vp.validators.length;i++){
    Validator validator = vp.validators[i];
    if(validator == BEAN_VALIDATOR) {
      validateBean = true;
      continue;
    }else{
      if(!validation.stateValidate(fullPropertyName, v, validator)){
        pass = false;
        if(validation.maxErrorsReached(maxErrors)){
          break;
        }
      }
    }
  }
  if(validateBean && pass && null != v) {
    return validate(fullPropertyName, v, validation, maxErrors);
  }
  return pass;
}

相关文章