toolbox.web.validation
Interface Validator

Package class diagram package Validator
All Known Implementing Classes:
FieldValidator, ValidatorImpl

public interface Validator

Defines an interface for form validation.


Method Summary
 java.util.List getFields(java.lang.String form)
          Return the List of Field instances supported by this Validator for the given "form" grouping.
 java.util.ResourceBundle getResource(java.util.Locale locale)
          Return the ResourceBundle that contains the error messages for this validator.
 void init(java.lang.String name, XMLProperties xmlProps)
          Validator initialisation must be performed here.
 java.util.Map validate(java.lang.String formName, javax.servlet.ServletRequest request)
          Validates the given request and returns a map of validated values.
 

Method Detail

init

void init(java.lang.String name,
          XMLProperties xmlProps)
          throws ValidationException
Validator initialisation must be performed here.

Parameters:
name - Name of this validator.
xmlProps - XML configuration properties.
Throws:
ValidationException - if the validator could not be initialised.

validate

java.util.Map validate(java.lang.String formName,
                       javax.servlet.ServletRequest request)
                       throws ValidationException
Validates the given request and returns a map of validated values.

Parameters:
formName - Name of the form to validate.
request - Serlvet request containing form data.
Returns:
Map containing the validated values.
Throws:
ValidationException - if the request could not be validated.

getResource

java.util.ResourceBundle getResource(java.util.Locale locale)
                                     throws ValidationException
Return the ResourceBundle that contains the error messages for this validator.

Parameters:
locale - Locale to use. May be null.
Returns:
ResourceBundle instance.
Throws:
ValidationException - if the resource cannot be obtained.

getFields

java.util.List getFields(java.lang.String form)
Return the List of Field instances supported by this Validator for the given "form" grouping.

Parameters:
form - String containing form grouping name.
Returns:
List containing Field instances for grouping.