com.sun.rave.web.ui.util
Class ResourceBundleManager

java.lang.Object
  extended by com.sun.rave.web.ui.util.ResourceBundleManager

public class ResourceBundleManager
extends java.lang.Object

This class caches ResourceBundle objects per locale.


Constructor Summary
protected ResourceBundleManager()
          Use getInstance() to obtain an instance.
 
Method Summary
protected  void addCachedBundle(java.lang.String baseName, java.util.Locale locale, java.util.ResourceBundle bundle)
          This method adds a ResourceBundle to the cache.
 java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale locale)
          This method obtains the requested resource bundle as specified by the given basename and locale.
 java.util.ResourceBundle getBundle(java.lang.String baseName, java.util.Locale locale, java.lang.ClassLoader loader)
          This method obtains the requested resource bundle as specified by the given basename, locale, and classloader.
protected  java.util.ResourceBundle getCachedBundle(java.lang.String baseName, java.util.Locale locale)
          This method checks the cache for the requested resource bundle.
protected  java.lang.String getCacheKey(java.lang.String baseName, java.util.Locale locale)
          This method generates a unique key for setting / getting Resources bundles from the cache.
static ResourceBundleManager getInstance()
          Use this method to get the instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleManager

protected ResourceBundleManager()
Use getInstance() to obtain an instance.

Method Detail

getInstance

public static ResourceBundleManager getInstance()
Use this method to get the instance of this class.


getCachedBundle

protected java.util.ResourceBundle getCachedBundle(java.lang.String baseName,
                                                   java.util.Locale locale)
This method checks the cache for the requested resource bundle.

Parameters:
baseName - Name of the bundle
locale - The locale
Returns:
The requested ResourceBundle in the most appropriate locale.

getCacheKey

protected java.lang.String getCacheKey(java.lang.String baseName,
                                       java.util.Locale locale)
This method generates a unique key for setting / getting Resources bundles from the cache. It is important to have different keys per locale (obviously).


addCachedBundle

protected void addCachedBundle(java.lang.String baseName,
                               java.util.Locale locale,
                               java.util.ResourceBundle bundle)
This method adds a ResourceBundle to the cache.


getBundle

public java.util.ResourceBundle getBundle(java.lang.String baseName,
                                          java.util.Locale locale)
This method obtains the requested resource bundle as specified by the given basename and locale.


getBundle

public java.util.ResourceBundle getBundle(java.lang.String baseName,
                                          java.util.Locale locale,
                                          java.lang.ClassLoader loader)
This method obtains the requested resource bundle as specified by the given basename, locale, and classloader.