Class FormSet
java.lang.Object
org.apache.commons.validator.FormSet
- All Implemented Interfaces:
Serializable
Holds a set of
Forms stored associated with a Locale
based on the country, language, and variant specified. Instances of this
class are configured with a <formset> xml element.- Version:
- $Revision: 1713331 $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionAMapofConstants using the name field of theConstantas the key.private StringCountry component ofLocale(optional).protected static final intThis is the type ofFormSets where only language and country locale are specified.AMapofForms using the name field of theFormas the key.protected static final intThis is the type ofFormSets where no locale is specified.private StringLanguage component ofLocale(required).protected static final intThis is the type ofFormSets where only language locale is specified.private org.apache.commons.logging.LogLoggingprivate booleanFlag indicating if this formSet has been merged with its parent (higher rank in Locale hierarchy).private booleanWhether or not the thisFormSetwas processed for replacing variables in strings with their values.private static final longprivate StringVariant component ofLocale(optional).protected static final intThis is the type ofFormSets where full locale has been set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConstant(String name, String value) Add aConstantto the locale level.voidAdd aFormto theFormSet.Returns a string representation of the object's key.Gets the equivalent of the country component ofLocale.Retrieve aFormbased on the form name.getForms()AMapofForms is returned as an unmodifiableMapwith the key based on the form name.Gets the equivalent of the language component ofLocale.private org.apache.commons.logging.LoggetLog()Accessor method for Log instance.protected intgetType()Returns the type ofFormSet:GLOBAL_FORMSET,LANGUAGE_FORMSET,COUNTRY_FORMSETorVARIANT_FORMSET.Gets the equivalent of the variant component ofLocale.protected booleanisMerged()Has this formSet been merged?booleanWhether or not the thisFormSetwas processed for replacing variables in strings with their values.protected voidMerges the givenFormSetinto this one.(package private) voidProcesses all of theForms.voidsetCountry(String country) Sets the equivalent of the country component ofLocale.voidsetLanguage(String language) Sets the equivalent of the language component ofLocale.voidsetVariant(String variant) Sets the equivalent of the variant component ofLocale.toString()Returns a string representation of the object.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
log
private transient org.apache.commons.logging.Log logLogging -
processed
private boolean processedWhether or not the thisFormSetwas processed for replacing variables in strings with their values. -
language
Language component ofLocale(required). -
country
Country component ofLocale(optional). -
variant
Variant component ofLocale(optional). -
forms
-
constants
-
GLOBAL_FORMSET
protected static final int GLOBAL_FORMSETThis is the type ofFormSets where no locale is specified.- See Also:
-
LANGUAGE_FORMSET
protected static final int LANGUAGE_FORMSETThis is the type ofFormSets where only language locale is specified.- See Also:
-
COUNTRY_FORMSET
protected static final int COUNTRY_FORMSETThis is the type ofFormSets where only language and country locale are specified.- See Also:
-
VARIANT_FORMSET
protected static final int VARIANT_FORMSETThis is the type ofFormSets where full locale has been set.- See Also:
-
merged
private boolean mergedFlag indicating if this formSet has been merged with its parent (higher rank in Locale hierarchy).
-
-
Constructor Details
-
FormSet
public FormSet()
-
-
Method Details
-
isMerged
protected boolean isMerged()Has this formSet been merged?- Returns:
- true if it has been merged
- Since:
- Validator 1.2.0
-
getType
protected int getType()Returns the type ofFormSet:GLOBAL_FORMSET,LANGUAGE_FORMSET,COUNTRY_FORMSETorVARIANT_FORMSET.- Returns:
- The type value
- Throws:
NullPointerException- if there is inconsistency in the locale definition (not sure about this)- Since:
- Validator 1.2.0
-
merge
Merges the givenFormSetinto this one. If any ofdependssFormsare not in thisFormSetthen, include them, else merge bothForms. Theoretically we should only merge a "parent" formSet.- Parameters:
depends- FormSet to be merged- Since:
- Validator 1.2.0
-
isProcessed
public boolean isProcessed()Whether or not the thisFormSetwas processed for replacing variables in strings with their values.- Returns:
- The processed value
-
getLanguage
Gets the equivalent of the language component ofLocale.- Returns:
- The language value
-
setLanguage
Sets the equivalent of the language component ofLocale.- Parameters:
language- The new language value
-
getCountry
Gets the equivalent of the country component ofLocale.- Returns:
- The country value
-
setCountry
Sets the equivalent of the country component ofLocale.- Parameters:
country- The new country value
-
getVariant
Gets the equivalent of the variant component ofLocale.- Returns:
- The variant value
-
setVariant
Sets the equivalent of the variant component ofLocale.- Parameters:
variant- The new variant value
-
addConstant
-
addForm
-
getForm
-
getForms
-
process
-
displayKey
Returns a string representation of the object's key.- Returns:
- A string representation of the key
-
toString
-
getLog
private org.apache.commons.logging.Log getLog()Accessor method for Log instance. The Log instance variable is transient and accessing it through this method ensures it is re-initialized when this instance is de-serialized.- Returns:
- The Log instance.
-