org.apache.commons.validator
Class FormSet
java.lang.Objectorg.apache.commons.validator.FormSet
- Serializable
public class FormSet
extends java.lang.Object
implements 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.
$Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $protected static int | COUNTRY_FORMSET- This is the type of
FormSets where only language and country
locale are specified.
|
protected static int | GLOBAL_FORMSET- This is the type of
FormSets where no locale is specified.
|
protected static int | LANGUAGE_FORMSET- This is the type of
FormSets where only language locale is
specified.
|
protected static int | VARIANT_FORMSET- This is the type of
FormSets where full locale has been set.
|
private Map | constants- A
Map of Constants using the name field of the
Constant as the key.
|
private String | country- Country component of
Locale (optional).
|
private Map | forms- A
Map of Forms using the name field of the
Form as the key.
|
private String | language- Language component of
Locale (required).
|
private 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 String | variant- Variant component of
Locale (optional).
|
void | addConstant(String name, String value)- Add a
Constant to the locale level.
|
void | addForm(Form f)- Add a
Form to the FormSet.
|
String | displayKey()- Returns a string representation of the object's key.
|
String | getCountry()- Gets the equivalent of the country component of
Locale.
|
Form | getForm(String formName)- Retrieve a
Form based on the form name.
|
Map | getForms()- A
Map of Forms is returned as an unmodifiable
Map with the key based on the form name.
|
String | getLanguage()- Gets the equivalent of the language component of
Locale.
|
private Log | getLog()- Accessor method for Log instance.
|
protected int | getType()- Returns the type of
FormSet:GLOBAL_FORMSET,
LANGUAGE_FORMSET,COUNTRY_FORMSET or VARIANT_FORMSET
.
|
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(Map globalConstants)- Processes all of the
Forms.
|
void | setCountry(String country)- Sets the equivalent of the country component of
Locale.
|
void | setLanguage(String language)- Sets the equivalent of the language component of
Locale.
|
void | setVariant(String variant)- Sets the equivalent of the variant component of
Locale.
|
String | toString()- Returns a string representation of the object.
|
COUNTRY_FORMSET
protected static final int COUNTRY_FORMSET
This is the type of FormSets where only language and country
locale are specified.
GLOBAL_FORMSET
protected static final int GLOBAL_FORMSET
This is the type of FormSets where no locale is specified.
LANGUAGE_FORMSET
protected static final int LANGUAGE_FORMSET
This is the type of FormSets where only language locale is
specified.
VARIANT_FORMSET
protected static final int VARIANT_FORMSET
This is the type of FormSets where full locale has been set.
constants
private Map constants
A Map of Constants using the name field of the
Constant as the key.
country
private String country
Country component of Locale (optional).
forms
private Map forms
A Map of Forms using the name field of the
Form as the key.
language
private String language
Language component of Locale (required).
log
private Log log
Logging
merged
private boolean merged
Flag indicating if this formSet has been merged with its parent (higher
rank in Locale hierarchy).
processed
private boolean processed
Whether or not the this FormSet was processed for replacing
variables in strings with their values.
variant
private String variant
Variant component of Locale (optional).
addConstant
public void addConstant(String name,
String value) Add a Constant to the locale level.
name - The constant namevalue - The constant value
addForm
public void addForm(Form f)
Add a Form to the FormSet.
displayKey
public String displayKey()
Returns a string representation of the object's key.
- A string representation of the key
getCountry
public String getCountry()
Gets the equivalent of the country component of Locale.
getForm
public Form getForm(String formName)
Retrieve a Form based on the form name.
getForms
public Map getForms()
A Map of Forms is returned as an unmodifiable
Map with the key based on the form name.
getLanguage
public String getLanguage()
Gets the equivalent of the language component of Locale.
getLog
private 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.
getType
protected int getType()
Returns the type of FormSet:GLOBAL_FORMSET,
LANGUAGE_FORMSET,COUNTRY_FORMSET or VARIANT_FORMSET
.
getVariant
public String getVariant()
Gets the equivalent of the variant component of Locale.
isMerged
protected boolean isMerged()
Has this formSet been merged?
- true if it has been merged
isProcessed
public boolean isProcessed()
Whether or not the this FormSet was processed for replacing
variables in strings with their values.
merge
protected void merge(FormSet depends)
Merges the given 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 merged
process
(package private) void process(Map globalConstants)
Processes all of the Forms.
globalConstants - Global constants
setCountry
public void setCountry(String country)
Sets the equivalent of the country component of Locale.
country - The new country value
setLanguage
public void setLanguage(String language)
Sets the equivalent of the language component of Locale.
language - The new language value
setVariant
public void setVariant(String variant)
Sets the equivalent of the variant component of Locale.
variant - The new variant value
toString
public String toString()
Returns a string representation of the object.
Copyright (c) 2001-2004 Apache Software Foundation