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 Summary
FieldsModifier and TypeFieldDescriptionstatic final String"flexible" Rule, used in DateFormat Validatorstatic final String"format" Rule, used in DateFormat Validatorstatic final String"invalidNumber" Rule, used in the various Number Validatorsstatic final String"mask" Rule, used in StringValidatorstatic final String"maxLength" Rule, used in all validatorsstatic final String"maxValue" Rule, used in the various Number Validatorsstatic final String"minLength" Rule, used in all validatorsstatic final String"minValue" Rule, used in the various Number Validatorsstatic final String"required" Rule, used in all validators -
Method Summary
Modifier and TypeMethodDescriptionvoidassertValidity(String testValue) Determine whether a testValue meets the criteria specified in the constraints defined for this validatorvoidassertValidity(Field<T> field) Determine whether a field meets the criteria specified in the constraints defined for this validatorGet the last error message resulting from invalid input.booleanDeprecated.use isValid(Field) insteadbooleanDetermine whether a field meets the criteria specified in the constraints defined for this validator
-
Field Details
-
FLEXIBLE_RULE_NAME
"flexible" Rule, used in DateFormat Validator- See Also:
-
FORMAT_RULE_NAME
"format" Rule, used in DateFormat Validator- See Also:
-
INVALID_NUMBER_RULE_NAME
"invalidNumber" Rule, used in the various Number Validators- See Also:
-
MASK_RULE_NAME
"mask" Rule, used in StringValidator- See Also:
-
MAX_LENGTH_RULE_NAME
"maxLength" Rule, used in all validators- See Also:
-
MAX_VALUE_RULE_NAME
"maxValue" Rule, used in the various Number Validators- See Also:
-
MIN_LENGTH_RULE_NAME
"minLength" Rule, used in all validators- See Also:
-
MIN_VALUE_RULE_NAME
"minValue" Rule, used in the various Number Validators- See Also:
-
REQUIRED_RULE_NAME
"required" Rule, used in all validators- See Also:
-
-
Method Details
-
isValid
Determine whether a field meets the criteria specified in the constraints defined for this validator- Parameters:
field- aFieldto be tested- Returns:
- true if valid, false otherwise
-
assertValidity
Determine whether a field meets the criteria specified in the constraints defined for this validator- Parameters:
field- aFieldto be tested- Throws:
ValidationException- containing an error message if the testValue did not pass the validation tests.
-
isValid
Deprecated.use isValid(Field) insteadDetermine whether a testValue meets the criteria specified in the constraints defined for this validator- Parameters:
testValue- aStringto be tested- Returns:
- true if valid, false otherwise
-
assertValidity
Determine whether a testValue meets the criteria specified in the constraints defined for this validator- Parameters:
testValue- aStringto 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
Stringmessage, or the empty String "".
-