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
FieldsModifier and TypeFieldDescriptionprotected org.apache.commons.collections.FastHashMapDeprecated.Subclasses should use getFieldMap() instead.protected StringThe name/key of the form which this form extends from.List ofFields.protected StringThe name/key the set of validation rules is stored under. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aFieldto theForm.booleancontainsField(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.AListofFields is returned as an unmodifiableList.getName()Gets the name/key of the set of validation rules.booleanGets extends flag.booleanWhether or not the thisFormwas processed for replacing variables in strings with their values.protected voidMerges the given form into this one.protected voidProcesses all of theForm'sFields.voidsetExtends(String inherit) Sets the name/key of the parent set of validation rules.voidSets 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 ofFields. Used to maintain the order they were added in although individualFields can be retrieved usingMapofFields. -
hFields
Deprecated.Subclasses should use getFieldMap() instead.Map ofFields 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 aFieldto 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
AListofFields 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 thisFormwas 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 independsnot present in this form, include it.dependshas 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'sFields.- 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.
-