public class FormSet
extends java.lang.Object
implements java.io.Serializable
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.Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.String> |
constants
A
Map of Constant s using the name field of the
Constant as the key. |
private java.lang.String |
country
Country component of
Locale (optional). |
protected static int |
COUNTRY_FORMSET
This is the type of
FormSet s where only language and country
locale are specified. |
private java.util.Map<java.lang.String,Form> |
forms
A
Map of Form s using the name field of the
Form as the key. |
protected static int |
GLOBAL_FORMSET
This is the type of
FormSet s where no locale is specified. |
private java.lang.String |
language
Language component of
Locale (required). |
protected static int |
LANGUAGE_FORMSET
This is the type of
FormSet s where only language locale is
specified. |
private org.apache.commons.logging.Log |
log
Logging
|
private boolean |
merged
Flag indicating if this formSet has been merged with its parent (higher
rank in Locale hierarchy).
|
private boolean |
processed
Whether or not the this
FormSet was processed for replacing
variables in strings with their values. |
private static long |
serialVersionUID |
private java.lang.String |
variant
Variant component of
Locale (optional). |
protected static int |
VARIANT_FORMSET
This is the type of
FormSet s where full locale has been set. |
Constructor and Description |
---|
FormSet() |
Modifier and Type | Method and Description |
---|---|
void |
addConstant(java.lang.String name,
java.lang.String value)
Add a
Constant to the locale level. |
void |
addForm(Form f)
Add a
Form to the FormSet . |
java.lang.String |
displayKey()
Returns a string representation of the object's key.
|
java.lang.String |
getCountry()
Gets the equivalent of the country component of
Locale . |
Form |
getForm(java.lang.String formName)
Retrieve a
Form based on the form name. |
java.util.Map<java.lang.String,Form> |
getForms()
A
Map of Form s is returned as an unmodifiable
Map with the key based on the form name. |
java.lang.String |
getLanguage()
Gets the equivalent of the language component of
Locale . |
private org.apache.commons.logging.Log |
getLog()
Accessor method for Log instance.
|
protected int |
getType()
Returns the type of
FormSet :GLOBAL_FORMSET ,
LANGUAGE_FORMSET ,COUNTRY_FORMSET or VARIANT_FORMSET
. |
java.lang.String |
getVariant()
Gets the equivalent of the variant component of
Locale . |
protected boolean |
isMerged()
Has this formSet been merged?
|
boolean |
isProcessed()
Whether or not the this
FormSet was processed for replacing
variables in strings with their values. |
protected void |
merge(FormSet depends)
Merges the given
FormSet into this one. |
(package private) void |
process(java.util.Map<java.lang.String,java.lang.String> globalConstants)
Processes all of the
Form s. |
void |
setCountry(java.lang.String country)
Sets the equivalent of the country component of
Locale . |
void |
setLanguage(java.lang.String language)
Sets the equivalent of the language component of
Locale . |
void |
setVariant(java.lang.String variant)
Sets the equivalent of the variant component of
Locale . |
java.lang.String |
toString()
Returns a string representation of the object.
|
private static final long serialVersionUID
private transient org.apache.commons.logging.Log log
private boolean processed
FormSet
was processed for replacing
variables in strings with their values.private java.lang.String language
Locale
(required).private java.lang.String country
Locale
(optional).private java.lang.String variant
Locale
(optional).private final java.util.Map<java.lang.String,Form> forms
Map
of Form
s using the name field of the
Form
as the key.private final java.util.Map<java.lang.String,java.lang.String> constants
Map
of Constant
s using the name field of the
Constant
as the key.protected static final int GLOBAL_FORMSET
FormSet
s where no locale is specified.protected static final int LANGUAGE_FORMSET
FormSet
s where only language locale is
specified.protected static final int COUNTRY_FORMSET
FormSet
s where only language and country
locale are specified.protected static final int VARIANT_FORMSET
FormSet
s where full locale has been set.private boolean merged
protected boolean isMerged()
protected int getType()
FormSet
:GLOBAL_FORMSET
,
LANGUAGE_FORMSET
,COUNTRY_FORMSET
or VARIANT_FORMSET
.java.lang.NullPointerException
- if there is inconsistency in the locale
definition (not sure about this)protected void merge(FormSet depends)
FormSet
into this one. If any of depends
s Forms
are not in this FormSet
then, include
them, else merge both Forms
. Theoretically we should only
merge a "parent" formSet.depends
- FormSet to be mergedpublic boolean isProcessed()
FormSet
was processed for replacing
variables in strings with their values.public java.lang.String getLanguage()
Locale
.public void setLanguage(java.lang.String language)
Locale
.language
- The new language valuepublic java.lang.String getCountry()
Locale
.public void setCountry(java.lang.String country)
Locale
.country
- The new country valuepublic java.lang.String getVariant()
Locale
.public void setVariant(java.lang.String variant)
Locale
.variant
- The new variant valuepublic void addConstant(java.lang.String name, java.lang.String value)
Constant
to the locale level.name
- The constant namevalue
- The constant valuepublic void addForm(Form f)
Form
to the FormSet
.f
- The formpublic Form getForm(java.lang.String formName)
Form
based on the form name.formName
- The form namepublic java.util.Map<java.lang.String,Form> getForms()
Map
of Form
s is returned as an unmodifiable
Map
with the key based on the form name.void process(java.util.Map<java.lang.String,java.lang.String> globalConstants)
Form
s.globalConstants
- Global constantspublic java.lang.String displayKey()
public java.lang.String toString()
toString
in class java.lang.Object
private org.apache.commons.logging.Log getLog()