org.apache.commons.validator
public class Form extends Object implements Serializable
This contains a set of validation rules for a form/JavaBean. The information is
contained in a list of Field
objects. Instances of this class are
configured with a <form> xml element.
The use of FastHashMap is deprecated and will be replaced in a future release.
Field Summary | |
---|---|
protected FastHashMap | hFields
Map of Field s keyed on their property value. |
protected List | lFields
List of Field s. |
protected String | name
The name/key the set of validation rules is
stored under. |
Method Summary | |
---|---|
void | addField(Field f)
Add a Field to the Form . |
boolean | containsField(String fieldName)
Returns true if this Form contains a Field with the given name. |
Field | getField(String fieldName)
Returns the Field with the given name or null if this Form has no such
field. |
Map | getFieldMap()
The Field s are returned as an unmodifiable Map . |
List | getFields()
A List of Field s is returned as an
unmodifiable List . |
String | getName()
Gets the name/key of the set of validation rules. |
void | process(Map globalConstants, Map constants)
Processes all of the Form 's Field s. |
void | setName(String name)
Sets the name/key of the set of validation rules. |
String | toString()
Returns a string representation of the object. |
ValidatorResults | validate(Map params, Map actions, int page)
Validate all Fields in this Form on the given page and below. |
Field
s keyed on their property value.Field
s. Used to maintain
the order they were added in although individual
Field
s can be retrieved using
Map
of Field
s.Field
to the Form
.Since: Validator 1.1
Since: Validator 1.1
Deprecated: Use containsField(String) and getField(String) instead.
TheField
s are returned as an unmodifiable Map
.List
of Field
s is returned as an
unmodifiable List
.Deprecated: This method is called by the framework. It will be made protected in a future release. TODO
Processes all of theForm
's Field
s.Parameters: params A Map of parameter class names to parameter values to pass into validation methods. actions A Map of validator names to ValidatorAction objects. page Fields on pages higher than this will not be validated.
Returns: A ValidatorResults object containing all validation messages.
Throws: ValidatorException