Interface IActionValidator
-
- All Known Implementing Classes:
AbstractFileValidator,AndValidator,EmailValidator,FileDoesNotExistValidator,FileExistsValidator,IntegerValidator,LongValidator,NotBlankValidator,NotNullValidator
public interface IActionValidatorThe interface of a action validator.Action validators can provide convenience methods for adding information to the validator context. Those methods should following a naming convention: putX where X is the name of the object being adding to the context. An example:
- ValidatorContext putSomeObject(Object someObject)
- void putSomeObject(ValidatorContext context, Object someObject)
-
-
Field Summary
Fields Modifier and Type Field Description static StringKEY_LEVEL_ON_FAIL
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetName()Returns the name of this validator, unique among all validators.booleanvalidate(ICheckResultSource source, String propertyName, List<ICheckResult> remarks, ValidatorContext context)Using reflection, the validator fetches the field namedpropertyNamefrom the beansourceand runs the validation putting any messages intoremarks.
-
-
-
Field Detail
-
KEY_LEVEL_ON_FAIL
static final String KEY_LEVEL_ON_FAIL
- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
boolean validate(ICheckResultSource source, String propertyName, List<ICheckResult> remarks, ValidatorContext context)
Using reflection, the validator fetches the field namedpropertyNamefrom the beansourceand runs the validation putting any messages intoremarks. The return value istrueif the validation passes.- Parameters:
source- bean to validatepropertyName- property to validateremarks- list to which to add messagescontext- any other information needed to perform the validation- Returns:
- validation result
-
getName
String getName()
Returns the name of this validator, unique among all validators.- Returns:
- name
-
-