Interface Validator<T>

All Known Implementing Classes:
BigDecimalValidator, BooleanValidator, DateRangeValidator, DateStringValidator, DefaultValidator, DoubleValidator, FileValidator, FloatValidator, IntegerRangeValidator, IntegerValidator, LongValidator, NumberValidator, ShortValidator, StringValidator

public interface Validator<T>
Validator api.
Version:
$Id$
Author:
John McNally, Thomas Vandahl
  • Field Details

    • FLEXIBLE_RULE_NAME

      static final String FLEXIBLE_RULE_NAME
      "flexible" Rule, used in DateFormat Validator
      See Also:
    • FORMAT_RULE_NAME

      static final String FORMAT_RULE_NAME
      "format" Rule, used in DateFormat Validator
      See Also:
    • INVALID_NUMBER_RULE_NAME

      static final String INVALID_NUMBER_RULE_NAME
      "invalidNumber" Rule, used in the various Number Validators
      See Also:
    • MASK_RULE_NAME

      static final String MASK_RULE_NAME
      "mask" Rule, used in StringValidator
      See Also:
    • MAX_LENGTH_RULE_NAME

      static final String MAX_LENGTH_RULE_NAME
      "maxLength" Rule, used in all validators
      See Also:
    • MAX_VALUE_RULE_NAME

      static final String MAX_VALUE_RULE_NAME
      "maxValue" Rule, used in the various Number Validators
      See Also:
    • MIN_LENGTH_RULE_NAME

      static final String MIN_LENGTH_RULE_NAME
      "minLength" Rule, used in all validators
      See Also:
    • MIN_VALUE_RULE_NAME

      static final String MIN_VALUE_RULE_NAME
      "minValue" Rule, used in the various Number Validators
      See Also:
    • REQUIRED_RULE_NAME

      static final String REQUIRED_RULE_NAME
      "required" Rule, used in all validators
      See Also:
  • Method Details

    • isValid

      boolean isValid(Field<T> field)
      Determine whether a field meets the criteria specified in the constraints defined for this validator
      Parameters:
      field - a Field to be tested
      Returns:
      true if valid, false otherwise
    • assertValidity

      void assertValidity(Field<T> field) throws ValidationException
      Determine whether a field meets the criteria specified in the constraints defined for this validator
      Parameters:
      field - a Field to be tested
      Throws:
      ValidationException - containing an error message if the testValue did not pass the validation tests.
    • isValid

      boolean isValid(String testValue)
      Deprecated.
      use isValid(Field) instead
      Determine whether a testValue meets the criteria specified in the constraints defined for this validator
      Parameters:
      testValue - a String to be tested
      Returns:
      true if valid, false otherwise
    • assertValidity

      void assertValidity(String testValue) throws ValidationException
      Determine whether a testValue meets the criteria specified in the constraints defined for this validator
      Parameters:
      testValue - a String to be tested
      Throws:
      ValidationException - containing an error message if the testValue did not pass the validation tests.
    • getMessage

      String getMessage()
      Get the last error message resulting from invalid input.
      Returns:
      a String message, or the empty String "".