Interface FormValidator
-
- All Known Implementing Classes:
ViewSettingsFormValidator
public interface FormValidator
Definition of an interface for objects that can validate forms.
While a normal validator can check only single fields of a form a
FormValidator
can deal with a form as a whole and thus can evaluate complex conditions and dependencies between the single elements.This kind of validation takes places only after validation on both the field and form level have succeeded. Validations performed by
FormValidator
implementations are logically related to form level validations. The main difference is that aFormValidator
can access all form fields at once and so is able to check relations between fields, too.Validation of a form as a whole is very specific and strongly depends on the data fields contained in the form and its model. So there is no default base implementation of this interface. A concrete implementation can access the whole data that was entered into the form - either by querying the
FieldHandler
objects of the form or by calling theForm.readFields(Object)
method passing in an appropriate data object - and perform arbitrary checks.- Version:
- $Id: FormValidator.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FormValidatorResults
isValid(Form form)
Validates the specified form.
-
-
-
Method Detail
-
isValid
FormValidatorResults isValid(Form form)
Validates the specified form. When this method is invoked by the form framework it is guaranteed that field and form level validation have passed. Thus allFieldHandler
objects contained in the form have been initialized with the current data entered by the user. One way to obtain this data is by callinggetData()
on aFieldHandler
. An alternative is to callreadFields()
on theForm
object and let the data be copied into a corresponding model object. (This model object must of course be compatible with theBindingStrategy
used by theForm
.- Parameters:
form
- the form object to be validated- Returns:
- an object with validation results
-
-