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.
- Version:
- $Revision: 1713331 $
- 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.private booleanWhether or not the thisFormwas processed for replacing variables in strings with their values.private static final long -
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.booleanGet 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.(package private) ValidatorResultsValidate all Fields in this Form on the given page and below.(package private) ValidatorResultsvalidate(Map<String, Object> params, Map<String, ValidatorAction> actions, int page, String fieldName) Validate all Fields in this Form on the given page and below.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
name
The name/key the set of validation rules is stored under. -
lFields
-
hFields
protected org.apache.commons.collections.FastHashMap hFieldsDeprecated.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:
- Validator 1.2.0
-
processed
private boolean processedWhether or not the thisFormwas processed for replacing variables in strings with their values.
-
-
Constructor Details
-
Form
public Form()
-
-
Method Details
-
getName
-
setName
Sets the name/key of the set of validation rules.- Parameters:
name- The new name value
-
addField
-
getFields
-
getField
-
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:
- Validator 1.1
-
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:
- Validator 1.2.0
-
process
-
toString
-
validate
ValidatorResults validate(Map<String, Object> params, Map<String, ValidatorAction> actions, int page) throws ValidatorExceptionValidate all Fields in this Form on the given page and below.- Parameters:
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.- Returns:
- A ValidatorResults object containing all validation messages.
- Throws:
ValidatorException
-
validate
ValidatorResults validate(Map<String, Object> params, Map<String, ValidatorAction> actions, int page, String fieldName) throws ValidatorExceptionValidate all Fields in this Form on the given page and below.- Parameters:
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.- Returns:
- A ValidatorResults object containing all validation messages.
- Throws:
ValidatorException- Since:
- 1.2.0
-
isProcessed
public boolean isProcessed()Whether or not the thisFormwas processed for replacing variables in strings with their values.- Returns:
- The processed value
- Since:
- Validator 1.2.0
-
getExtends
Gets the name/key of the parent set of validation rules.- Returns:
- The extends value
- Since:
- Validator 1.2.0
-
setExtends
Sets the name/key of the parent set of validation rules.- Parameters:
inherit- The new extends value- Since:
- Validator 1.2.0
-
isExtending
public boolean isExtending()Get extends flag.- Returns:
- The extending value
- Since:
- Validator 1.2.0
-
getFieldMap
-