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.
$Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $protected FastHashMap | hFields - Subclasses should use getFieldMap() instead.
|
protected String | inherit - The name/key of the form which this form extends from.
|
protected List | lFields - List of
Field s.
|
protected String | name - The name/key the set of validation rules is stored under.
|
private boolean | processed - Whether or not the this
Form was processed for replacing
variables in strings with their values.
|
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.
|
String | getExtends() - Gets the name/key of the parent set of validation rules.
|
Field | getField(String fieldName) - Returns the Field with the given name or null if this Form has no such
field.
|
protected Map | getFieldMap() - Returns a Map of String field keys to Field objects.
|
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.
|
boolean | isExtending() - Get extends flag.
|
boolean | isProcessed() - Whether or not the this
Form was processed for replacing
variables in strings with their values.
|
protected void | merge(Form depends) - Merges the given form into this one.
|
protected void | process(Map globalConstants, Map constants, Map forms) - Processes all of the
Form 's Field s.
|
void | setExtends(String inherit) - Sets the name/key of the parent set of validation rules.
|
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.
|
(package private) ValidatorResults | validate(Map params, Map actions, int page, String fieldName) - Validate all Fields in this Form on the given page and below.
|
hFields
protected FastHashMap hFields
Subclasses should use getFieldMap() instead.
Map of Field
s keyed on their property value.
inherit
protected String inherit
The name/key of the form which this form extends from.
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.
processed
private boolean processed
Whether or not the this Form
was processed for replacing
variables in strings with their values.
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.
fieldName
- The field name
- True if this form contains the field by the given name
getExtends
public String getExtends()
Gets the name/key of the parent set of validation rules.
getField
public Field getField(String fieldName)
Returns the Field with the given name or null if this Form has no such
field.
fieldName
- The field name
getFieldMap
protected Map getFieldMap()
Returns a Map of String field keys to Field objects.
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.
isExtending
public boolean isExtending()
Get extends flag.
isProcessed
public boolean isProcessed()
Whether or not the this Form
was processed for replacing
variables in strings with their values.
merge
protected void merge(Form depends)
Merges the given form into this one. For any field in depends
not present in this form, include it. depends
has precedence
in the way the fields are ordered.
depends
- the form we want to merge
process
protected void process(Map globalConstants,
Map constants,
Map forms)
Processes all of the Form
's Field
s.
globalConstants
- A map of global constantsconstants
- Local constantsforms
- Map of forms
setExtends
public void setExtends(String inherit)
Sets the name/key of the parent set of validation rules.
inherit
- The new extends value
setName
public void setName(String name)
Sets the name/key of the set of validation rules.
name
- The new name value
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.
validate
(package private) ValidatorResults validate(Map params,
Map actions,
int page,
String fieldName)
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.
Copyright (c) 2001-2004 Apache Software Foundation