Package org.apache.commons.validator
Class Form
java.lang.Object
org.apache.commons.validator.Form
- All Implemented Interfaces:
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.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.commons.collections.FastHashMap
Deprecated.Subclasses should use getFieldMap() instead.protected String
The name/key of the form which this form extends from.List ofField
s.protected String
The name/key the set of validation rules is stored under. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add aField
to theForm
.boolean
containsField
(String fieldName) Returns true if this Form contains a Field with the given name.Gets the name/key of the parent set of validation rules.Returns the Field with the given name or null if this Form has no such field.Returns a Map of String field keys to Field objects.AList
ofField
s is returned as an unmodifiableList
.getName()
Gets the name/key of the set of validation rules.boolean
Gets extends flag.boolean
Whether or not the thisForm
was processed for replacing variables in strings with their values.protected void
Merges the given form into this one.protected void
Processes all of theForm
'sField
s.void
setExtends
(String inherit) Sets the name/key of the parent set of validation rules.void
Sets the name/key of the set of validation rules.toString()
Returns a string representation of the object.
-
Field Details
-
name
The name/key the set of validation rules is stored under. -
lFields
List ofField
s. Used to maintain the order they were added in although individualField
s can be retrieved usingMap
ofField
s. -
hFields
Deprecated.Subclasses should use getFieldMap() instead.Map ofField
s keyed on their property value. -
inherit
The name/key of the form which this form extends from.- Since:
- 1.2.0
-
-
Constructor Details
-
Form
public Form()
-
-
Method Details
-
addField
Add aField
to theForm
.- Parameters:
f
- The field
-
containsField
Returns true if this Form contains a Field with the given name.- Parameters:
fieldName
- The field name- Returns:
- True if this form contains the field by the given name
- Since:
- 1.1
-
getExtends
Gets the name/key of the parent set of validation rules.- Returns:
- The extends value
- Since:
- 1.2.0
-
getField
Returns the Field with the given name or null if this Form has no such field.- Parameters:
fieldName
- The field name- Returns:
- The field value
- Since:
- 1.1
-
getFieldMap
Returns a Map of String field keys to Field objects.- Returns:
- The fieldMap value
- Since:
- 1.2.0
-
getFields
AList
ofField
s is returned as an unmodifiableList
.- Returns:
- The fields value
-
getName
Gets the name/key of the set of validation rules.- Returns:
- The name value
-
isExtending
Gets extends flag.- Returns:
- The extending value
- Since:
- 1.2.0
-
isProcessed
Whether or not the thisForm
was processed for replacing variables in strings with their values.- Returns:
- The processed value
- Since:
- 1.2.0
-
merge
Merges the given form into this one. For any field independs
not present in this form, include it.depends
has precedence in the way the fields are ordered.- Parameters:
depends
- the form we want to merge- Since:
- 1.2.0
-
process
protected void process(Map<String, String> globalConstants, Map<String, String> constants, Map<String, Form> forms) Processes all of theForm
'sField
s.- Parameters:
globalConstants
- A map of global constantsconstants
- Local constantsforms
- Map of forms- Since:
- 1.2.0
-
setExtends
Sets the name/key of the parent set of validation rules.- Parameters:
inherit
- The new extends value- Since:
- 1.2.0
-
setName
Sets the name/key of the set of validation rules.- Parameters:
name
- The new name value
-
toString
Returns a string representation of the object.
-