Class FormSet

java.lang.Object
org.apache.commons.validator.FormSet
All Implemented Interfaces:
Serializable

public class FormSet extends 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.
See Also:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
    This is the type of FormSets where only language and country locale are specified.
    protected static final int
    This is the type of FormSets where no locale is specified.
    protected static final int
    This is the type of FormSets where only language locale is specified.
    protected static final int
    This is the type of FormSets where full locale has been set.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Constructs a new instance.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    void
    addConstant(String name, String value)
    Add a Constant to the locale level.
    void
    Add a Form to the FormSet.
    Returns a string representation of the object's key.
    Gets the equivalent of the country component of Locale.
    getForm(String formName)
    Retrieve a Form based on the form name.
    A Map of Forms is returned as an unmodifiable Map with the key based on the form name.
    Gets the equivalent of the language component of Locale.
    protected int
    Returns the type of FormSet:GLOBAL_FORMSET, LANGUAGE_FORMSET,COUNTRY_FORMSET or VARIANT_FORMSET.
    Gets the equivalent of the variant component of Locale.
    protected boolean
    Has this formSet been merged?
    boolean
    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.
    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.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details Link icon

  • Constructor Details Link icon

    • FormSet Link icon

      public FormSet()
      Constructs a new instance.
  • Method Details Link icon

    • addConstant Link icon

      public void addConstant(String name, String value)
      Add a Constant to the locale level.
      Parameters:
      name - The constant name
      value - The constant value
    • addForm Link icon

      public void addForm(Form f)
      Add a Form to the FormSet.
      Parameters:
      f - The form
    • displayKey Link icon

      public String displayKey()
      Returns a string representation of the object's key.
      Returns:
      A string representation of the key
    • getCountry Link icon

      public String getCountry()
      Gets the equivalent of the country component of Locale.
      Returns:
      The country value
    • getForm Link icon

      public Form getForm(String formName)
      Retrieve a Form based on the form name.
      Parameters:
      formName - The form name
      Returns:
      The form
    • getForms Link icon

      public Map<String,Form> getForms()
      A Map of Forms is returned as an unmodifiable Map with the key based on the form name.
      Returns:
      The forms map
    • getLanguage Link icon

      public String getLanguage()
      Gets the equivalent of the language component of Locale.
      Returns:
      The language value
    • getType Link icon

      protected int getType()
      Returns the type of FormSet:GLOBAL_FORMSET, LANGUAGE_FORMSET,COUNTRY_FORMSET or VARIANT_FORMSET.
      Returns:
      The type value
      Throws:
      NullPointerException - if there is inconsistency in the locale definition (not sure about this)
      Since:
      1.2.0
    • getVariant Link icon

      public String getVariant()
      Gets the equivalent of the variant component of Locale.
      Returns:
      The variant value
    • isMerged Link icon

      protected boolean isMerged()
      Has this formSet been merged?
      Returns:
      true if it has been merged
      Since:
      1.2.0
    • isProcessed Link icon

      public boolean isProcessed()
      Whether or not the this FormSet was processed for replacing variables in strings with their values.
      Returns:
      The processed value
    • merge Link icon

      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.
      Parameters:
      depends - FormSet to be merged
      Since:
      1.2.0
    • setCountry Link icon

      public void setCountry(String country)
      Sets the equivalent of the country component of Locale.
      Parameters:
      country - The new country value
    • setLanguage Link icon

      public void setLanguage(String language)
      Sets the equivalent of the language component of Locale.
      Parameters:
      language - The new language value
    • setVariant Link icon

      public void setVariant(String variant)
      Sets the equivalent of the variant component of Locale.
      Parameters:
      variant - The new variant value
    • toString Link icon

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      A string representation