pt.moredata.dataentry.util
Class BundleCache

java.lang.Object
  extended bypt.moredata.dataentry.util.BundleCache

public class BundleCache
extends java.lang.Object

Static ResourceBundle cache. XXX : Migrar para pt.moredata.util ? Company MoreData

Version:
$Revision: 1.2 $
Author:
pcarmo

Method Summary
 void addBundle(java.util.ResourceBundle bundle, java.lang.String base)
          Adds a new ResourceBundle to the cache.
 java.util.ResourceBundle getBundle(java.lang.String base, java.util.Locale locale)
          Returns a ResourceBundle for the given locale with a specified base name.
 java.lang.String getErrorMessage(java.lang.String key)
          Returns a error message from the 'errorMessages' ResourceBundle.
 java.lang.Object getObject(java.lang.String base, java.util.Locale locale, java.lang.String key)
          Returns a Object for the given locale and key from the resource file.
 java.lang.String getString(java.lang.String base, java.util.Locale locale, java.lang.String key)
          Returns a String for the given locale and key from the resource file.
 java.lang.String[] getStringArray(java.lang.String base, java.util.Locale locale, java.lang.String key)
          Returns a StringArray for the given locale and key from the resource file.
static BundleCache instance()
          Devolve a instancia (singleton) do BundleCache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static BundleCache instance()
Devolve a instancia (singleton) do BundleCache.

Returns:
A instancia (singleton) do BundleCache.

addBundle

public void addBundle(java.util.ResourceBundle bundle,
                      java.lang.String base)
Adds a new ResourceBundle to the cache.

Parameters:
bundle - The resourceBundle.
base - The base name of the ResourceBundle

getBundle

public java.util.ResourceBundle getBundle(java.lang.String base,
                                          java.util.Locale locale)
                                   throws java.util.MissingResourceException
Returns a ResourceBundle for the given locale with a specified base name.

Parameters:
base - The base name of the resourse file to search for.
locale - A java.util.Locale.
Returns:
ResourceBundle with the specified base name for the given locale.
Throws:
java.util.MissingResourceException - if no ResourceBundle was found with the given base name.

getObject

public java.lang.Object getObject(java.lang.String base,
                                  java.util.Locale locale,
                                  java.lang.String key)
                           throws java.util.MissingResourceException
Returns a Object for the given locale and key from the resource file.

Parameters:
base - The base name of the resourse file to search for.
locale - A java.util.Locale.
key - the key of the object.
Returns:
A Object for the given locale and key.
Throws:
java.util.MissingResourceException - if no Object was found for the given key.

getString

public java.lang.String getString(java.lang.String base,
                                  java.util.Locale locale,
                                  java.lang.String key)
                           throws java.util.MissingResourceException
Returns a String for the given locale and key from the resource file.

Parameters:
base - The base name of the resourse file to search for.
locale - A java.util.Locale.
key - the key of the object.
Returns:
A String for the given locale and key.
Throws:
java.util.MissingResourceException - if no String was found for the given key.

getStringArray

public java.lang.String[] getStringArray(java.lang.String base,
                                         java.util.Locale locale,
                                         java.lang.String key)
                                  throws java.util.MissingResourceException
Returns a StringArray for the given locale and key from the resource file.

Parameters:
base - The base name of the resourse file to search for.
locale - A java.util.Locale.
key - the key of the object.
Returns:
A StringArray for the given locale and key.
Throws:
java.util.MissingResourceException - if no StringArray was found for the given key.

getErrorMessage

public java.lang.String getErrorMessage(java.lang.String key)
Returns a error message from the 'errorMessages' ResourceBundle.

Parameters:
key - The key of the error message.
Returns:
A error message from the 'errorMessages' ResourceBundle.