| org.iscreen.Validator
All known Subclasses: org.iscreen.impl.MockValidator, org.iscreen.validators.DateRangeValidator, org.iscreen.BaseValidator,
Validator | public interface Validator (Code) | | Implementations of this interface are expected to validate a JavaBean's
properties. The JavaBean to be validated is the one returned by the call
to constructBeanToValidate().
The lifecycle of Validators (implementations of this interface) is as
follows:
- Construction: Validators should have a public, no-parameter constructor.
- Constraints: Constraints (properties) on the Validator (from configuration)
are set.
- Failure Messages: Properties configured as "Failure Messages" are set.
These properties are used to report validation failures.
- For each validation: constructBeanToValidate() is called to get the JavaBean
that will have properties mapped to it so that the
constructed bean can be passed in to the validate() method.
- For each validation: validate() is called to validate the passed in JavaBean.
author: Shellman, Dan |
Method Summary | |
Object | constructBeanToValidate() This is called prior to calling the validate() method. | void | validate(ValidatorContext context, Object beanToValidate) This is the method that's called to validate the "bean-to-validate."
Use the passed in ValidatorContext to report validation failures, etc. |
constructBeanToValidate | Object constructBeanToValidate()(Code) | | This is called prior to calling the validate() method. This method is
meant to construct a JavaBean that will have properties mapped to it
for use by the validator.
Returns a JavaBean that will have properties mapped to it foruse by the call to the validate() method. |
validate | void validate(ValidatorContext context, Object beanToValidate)(Code) | | This is the method that's called to validate the "bean-to-validate."
Use the passed in ValidatorContext to report validation failures, etc.
The passed-in "bean-to-validate" is the same instance returned from
the call to constructBeanToValidate(), but with all of the appropriate
properties set (based upon the configured mapping).
Parameters: context - The ValidatorContext, which is used to report failures. Parameters: beanToValidate - The JavaBean to validate. |
|
|