java.io.Serializable
public class Form
extends java.lang.Object
implements java.io.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.
Modifier and Type | Field | Description |
---|---|---|
protected org.apache.commons.collections.FastHashMap |
hFields |
Deprecated.
Subclasses should use getFieldMap() instead.
|
protected java.lang.String |
inherit |
The name/key of the form which this form extends from.
|
protected java.util.List |
lFields |
List of
Field s. |
protected java.lang.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. |
Constructor | Description |
---|---|
Form() |
Modifier and Type | Method | Description |
---|---|---|
void |
addField(Field f) |
Add a
Field to the Form . |
boolean |
containsField(java.lang.String fieldName) |
Returns true if this Form contains a Field with the given name.
|
java.lang.String |
getExtends() |
Gets the name/key of the parent set of validation rules.
|
Field |
getField(java.lang.String fieldName) |
Returns the Field with the given name or null if this Form has no such
field.
|
protected java.util.Map |
getFieldMap() |
Returns a Map of String field keys to Field objects.
|
java.util.List |
getFields() |
A
List of Field s is returned as an unmodifiable
List . |
java.lang.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(java.util.Map globalConstants,
java.util.Map constants,
java.util.Map forms) |
Processes all of the
Form 's Field s. |
void |
setExtends(java.lang.String inherit) |
Sets the name/key of the parent set of validation rules.
|
void |
setName(java.lang.String name) |
Sets the name/key of the set of validation rules.
|
java.lang.String |
toString() |
Returns a string representation of the object.
|
(package private) ValidatorResults |
validate(java.util.Map params,
java.util.Map actions,
int page) |
Validate all Fields in this Form on the given page and below.
|
(package private) ValidatorResults |
validate(java.util.Map params,
java.util.Map actions,
int page,
java.lang.String fieldName) |
Validate all Fields in this Form on the given page and below.
|
protected java.lang.String name
protected java.util.List lFields
Field
s. Used to maintain the order they were added
in although individual Field
s can be retrieved using Map
of Field
s.protected org.apache.commons.collections.FastHashMap hFields
Field
s keyed on their property value.protected java.lang.String inherit
private boolean processed
Form
was processed for replacing
variables in strings with their values.public java.lang.String getName()
public void setName(java.lang.String name)
name
- The new name valuepublic void addField(Field f)
Field
to the Form
.f
- The fieldpublic java.util.List getFields()
List
of Field
s is returned as an unmodifiable
List
.public Field getField(java.lang.String fieldName)
fieldName
- The field namepublic boolean containsField(java.lang.String fieldName)
fieldName
- The field nameprotected void merge(Form depends)
depends
not present in this form, include it. depends
has precedence
in the way the fields are ordered.depends
- the form we want to mergeprotected void process(java.util.Map globalConstants, java.util.Map constants, java.util.Map forms)
Form
's Field
s.globalConstants
- A map of global constantsconstants
- Local constantsforms
- Map of formspublic java.lang.String toString()
toString
in class java.lang.Object
ValidatorResults validate(java.util.Map params, java.util.Map actions, int page) throws ValidatorException
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.ValidatorException
ValidatorResults validate(java.util.Map params, java.util.Map actions, int page, java.lang.String fieldName) throws ValidatorException
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.ValidatorException
public boolean isProcessed()
Form
was processed for replacing
variables in strings with their values.public java.lang.String getExtends()
public void setExtends(java.lang.String inherit)
inherit
- The new extends valuepublic boolean isExtending()
protected java.util.Map getFieldMap()
Copyright (c) 2001-2004 Apache Software Foundation