Interface FormValidatorResults
-
- All Known Implementing Classes:
DefaultFormValidatorResults
public interface FormValidatorResults
Definition of an interface for describing results of a form validation.
This interface is closely related to the
interface from theValidationResult
transform
package. The difference is that it does not represent results of a single field's validation, but can contain multiple result objects for an arbitrary number of fields. So it can easily be checked, which fields of a form are valid and which are not, and for fields with invalid data the corresponding error messages can be retrieved.Basically objects implementing this interface can be seen as composite validation result objects. By providing the name of a field the corresponding
ValidationResult
object can be obtained. There are also methods for testing if the whole validation was successful or for retrieving only the names of the fields that contain invalid data.- Version:
- $Id: FormValidatorResults.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 Set<String>
getErrorFieldNames()
Returns a set with the names of only those fields, for which validation has failed.Set<String>
getFieldNames()
Returns a set with the names of all fields, for which result objects are stored in this object.ValidationResult
getResultsFor(String field)
Returns theValidationResult
object for the specified field.boolean
isValid()
Checks if the whole validation was successful.
-
-
-
Method Detail
-
isValid
boolean isValid()
Checks if the whole validation was successful. If this method returns true , there are no form fields that caused validation errors.- Returns:
- a flag if the validation of the form was successful
-
getFieldNames
Set<String> getFieldNames()
Returns a set with the names of all fields, for which result objects are stored in this object.- Returns:
- a set with the names of all available fields
-
getErrorFieldNames
Set<String> getErrorFieldNames()
Returns a set with the names of only those fields, for which validation has failed.- Returns:
- a set with the names of the error fields
-
getResultsFor
ValidationResult getResultsFor(String field)
Returns theValidationResult
object for the specified field. This object can then be used to check if validation of this field was successful or to retrieve all available error messages.- Parameters:
field
- the name of the desired field- Returns:
- the validation result object for this field
-
-