示例#1
0
  public void fieldDisposed(DataModelField<ValueType> field) {
    for (FieldValidationRule<ValueType> rule : this.rules) {
      rule.fieldDisposed(field);
    }

    this.fieldsToValidate.remove(field);
  }
示例#2
0
  public Collection<String> runValidation(DataModel model) {
    Collection<String> errorMessages = new ArrayList<String>();

    for (DataModelField<ValueType> field : this.fieldsToValidate) {
      String errorHeader =
          String.format(
              "(%s%s, %s): ", this.baseFieldName, field.getName(), field.getValue().toString());

      for (FieldValidationRule<ValueType> rule : this.rules) {
        try {
          rule.validateField(field, model);
        } catch (ModelValidationException e) {
          String errorMessage = errorHeader + e.getMessage();
          errorMessages.add(errorMessage);
        }
      }
    }

    return errorMessages;
  }
示例#3
0
 public void fieldsUpdated(Collection<DataModelField<ValueType>> fields) {
   for (FieldValidationRule<ValueType> rule : this.rules) {
     rule.fieldsUpdated(fields);
   }
 }
示例#4
0
 public void fieldUpdated(DataModelField<ValueType> field) {
   for (FieldValidationRule<ValueType> rule : this.rules) {
     rule.fieldUpdated(field);
   }
 }