pt.moredata.util
Class BundleCache

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

public class BundleCache
extends java.lang.Object

BundleCache.java Company MoreData

Version:
$Revision: 1.1.1.1 $
Author:
pcarmo

Constructor Summary
BundleCache()
          Creates a new instance of BundleCache
 
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.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleCache

public BundleCache()
Creates a new instance of BundleCache

Method Detail

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.

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:
A ResourceBundle with the specified base name for the given locale.
Throws:
java.util.MissingResourceException - if no ResourceBundle was found with the given base name.

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