org.apache.commons.validator
Class Form
java.lang.Object
org.apache.commons.validator.Form
- Serializable
public class Form
extends java.lang.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.
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.
|
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() - Use containsField(String) and getField(String) instead.
|
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) - This method is called by the framework.
|
void | setName(String name) - Sets the name/key of the set of validation rules.
|
String | toString() - Returns a string representation of the object.
|
(package private) ValidatorResults | validate(Map params, Map actions, int page) - Validate all Fields in this Form on the given page and below.
|
hFields
protected FastHashMap hFields
Map of Field
s keyed on their property value.
lFields
protected List lFields
List of Field
s. Used to maintain
the order they were added in although individual
Field
s can be retrieved using
Map
of Field
s.
name
protected String name
The name/key the set of validation rules is
stored under.
addField
public void addField(Field f)
Add a Field
to the Form
.
containsField
public boolean containsField(String fieldName)
Returns true if this Form contains a Field with the given name.
- Validator 1.1
getField
public Field getField(String fieldName)
Returns the Field with the given name or null if this Form has no such
field.
- Validator 1.1
getFieldMap
public Map getFieldMap()
Use containsField(String) and getField(String) instead.
The Field
s are returned as an unmodifiable Map
.
getFields
public List getFields()
A List
of Field
s is returned as an
unmodifiable List
.
getName
public String getName()
Gets the name/key of the set of validation rules.
process
public void process(Map globalConstants,
Map constants)
This method is called by the framework. It will be made protected
in a future release. TODO
Processes all of the Form
's Field
s.
setName
public void setName(String name)
Sets the name/key of the set of validation rules.
toString
public String toString()
Returns a string representation of the object.
validate
(package private) ValidatorResults validate(Map params,
Map actions,
int page)
throws ValidatorException
Validate all Fields in this Form on the given page and below.
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.
- A ValidatorResults object containing all validation messages.
ValidatorException
-
Copyright (c) 2001-2004 Apache Software Foundation