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

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

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

Validation.maxErrorsReached介绍

暂无

代码示例

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

protected boolean validateEntity(EntityWrapper entity,Validation validation,int maxErrors,EntityValidator[] validators){
    boolean pass = true;
    
    for(int i=0;i<validators.length;i++){
      if(!validators[i].validate(entity, validation, maxErrors)){
        pass = false;
        if(validation.maxErrorsReached(maxErrors)){
          break;
        }
      }
    }
    return pass;
  }
}

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

protected boolean validateField(EntityWrapper entity, Validation validation, int maxErrors, FieldMapping fm) {
  FieldValidator[] validators = fm.getValidators();
  if(validators.length > 0){
    if(validateField(entity, validation, maxErrors, fm, validators)){
      return false;
    }
    if(validation.maxErrorsReached(maxErrors)){
      return false;
    }
  }
  return true;
}

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

protected boolean validate(String name, Object bean, Validation validation, int maxErrors, BeanType bt, ValidatedProperty[] vps) {
  //Validate properties
  
  boolean pass = true;
  
  for(int i=0;i<vps.length;i++){
    ValidatedProperty vp = vps[i];
    
    if(!validateProperty(name, bean, validation, maxErrors, vp)){
      pass = false;
      
      if(validation.maxErrorsReached(maxErrors)){
        return pass;
      }
    }
  }
  
  if(bean instanceof Validatable){
    return ((Validatable) bean).validate(validation,maxErrors);
  }
  
  return pass;
}

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

protected boolean validateField(EntityWrapper entity, Validation validation, int maxErrors, FieldMapping fm, FieldValidator[] validators){
  Object value = entity.get(fm.getFieldName());
  
  //Validates : not null
  if(!fm.isNullable()){
    if(!validation.stateRequired(fm.getFieldName(), value)){
      return validation.maxErrorsReached(maxErrors);
    }
  }
  
  //Validated by validators
  for(int i=0;i<validators.length;i++){
    validators[i].validate(entity, fm, value, validation, maxErrors);
    if(validation.maxErrorsReached(maxErrors)){
      return true;
    }
  }
  
  return false;
}

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

if(validation.maxErrorsReached(maxErrors)){
  return false;
  if(validation.maxErrorsReached(maxErrors)){
    return false;

代码示例来源: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;
}

相关文章