Package org.apache.commons.validator
Class FormSet
java.lang.Object
org.apache.commons.validator.FormSet
- All Implemented Interfaces:
Serializable
Holds a set of
Form
s stored associated with a Locale
based on the country, language, and variant specified. Instances of this
class are configured with a <formset> xml element.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
This is the type ofFormSet
s where only language and country locale are specified.protected static final int
This is the type ofFormSet
s where no locale is specified.protected static final int
This is the type ofFormSet
s where only language locale is specified.protected static final int
This is the type ofFormSet
s where full locale has been set. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConstant
(String name, String value) Add aConstant
to the locale level.void
Add aForm
to theFormSet
.Returns a string representation of the object's key.Gets the equivalent of the country component ofLocale
.Retrieve aForm
based on the form name.getForms()
AMap
ofForm
s is returned as an unmodifiableMap
with the key based on the form name.Gets the equivalent of the language component ofLocale
.protected int
getType()
Returns the type ofFormSet
:GLOBAL_FORMSET
,LANGUAGE_FORMSET
,COUNTRY_FORMSET
orVARIANT_FORMSET
.Gets the equivalent of the variant component ofLocale
.protected boolean
isMerged()
Has this formSet been merged?boolean
Whether or not the thisFormSet
was processed for replacing variables in strings with their values.protected void
Merges the givenFormSet
into this one.void
setCountry
(String country) Sets the equivalent of the country component ofLocale
.void
setLanguage
(String language) Sets the equivalent of the language component ofLocale
.void
setVariant
(String variant) Sets the equivalent of the variant component ofLocale
.toString()
Returns a string representation of the object.
-
Field Details
-
GLOBAL_FORMSET
This is the type ofFormSet
s where no locale is specified.- See Also:
-
LANGUAGE_FORMSET
This is the type ofFormSet
s where only language locale is specified.- See Also:
-
COUNTRY_FORMSET
This is the type ofFormSet
s where only language and country locale are specified.- See Also:
-
VARIANT_FORMSET
This is the type ofFormSet
s where full locale has been set.- See Also:
-
-
Constructor Details
-
FormSet
public FormSet()
-
-
Method Details
-
addConstant
Add aConstant
to the locale level.- Parameters:
name
- The constant namevalue
- The constant value
-
addForm
Add aForm
to theFormSet
.- Parameters:
f
- The form
-
displayKey
Returns a string representation of the object's key.- Returns:
- A string representation of the key
-
getCountry
Gets the equivalent of the country component ofLocale
.- Returns:
- The country value
-
getForm
Retrieve aForm
based on the form name.- Parameters:
formName
- The form name- Returns:
- The form
-
getForms
AMap
ofForm
s is returned as an unmodifiableMap
with the key based on the form name.- Returns:
- The forms map
-
getLanguage
Gets the equivalent of the language component ofLocale
.- Returns:
- The language value
-
getType
Returns the type ofFormSet
:GLOBAL_FORMSET
,LANGUAGE_FORMSET
,COUNTRY_FORMSET
orVARIANT_FORMSET
.- Returns:
- The type value
- Throws:
NullPointerException
- if there is inconsistency in the locale definition (not sure about this)- Since:
- 1.2.0
-
getVariant
Gets the equivalent of the variant component ofLocale
.- Returns:
- The variant value
-
isMerged
Has this formSet been merged?- Returns:
- true if it has been merged
- Since:
- 1.2.0
-
isProcessed
Whether or not the thisFormSet
was processed for replacing variables in strings with their values.- Returns:
- The processed value
-
merge
Merges the givenFormSet
into this one. If any ofdepends
sForms
are not in thisFormSet
then, include them, else merge bothForms
. Theoretically we should only merge a "parent" formSet.- Parameters:
depends
- FormSet to be merged- Since:
- 1.2.0
-
setCountry
Sets the equivalent of the country component ofLocale
.- Parameters:
country
- The new country value
-
setLanguage
Sets the equivalent of the language component ofLocale
.- Parameters:
language
- The new language value
-
setVariant
Sets the equivalent of the variant component ofLocale
.- Parameters:
variant
- The new variant value
-
toString
Returns a string representation of the object.
-