QJCC homepage

biz.chitec.quarterback.util
Class HierarchicalResourceBundle

java.lang.Object
  extended byjava.util.ResourceBundle
      extended bybiz.chitec.quarterback.util.HierarchicalResourceBundle
Direct Known Subclasses:
SelfLoadingClassBasedResourceBundle

public class HierarchicalResourceBundle
extends java.util.ResourceBundle

ResourceBundle which is built out of several hierarchial grouped bundles. This is a helper class for the static RB methods

Version:
$Id: 87f36f772ac1c3f20f8dc2a9a254882adb30b44b $
Author:
Dirk Hillbrecht 2000, chitec/Dirk Hillbrecht 2000, cantamen/Dirk Hillbrecht 2003,2005,2008. Distributed under the terms of the GNU LGPL.

Nested Class Summary
 
Nested classes inherited from class java.util.ResourceBundle
 
Field Summary
private  java.util.List rbs
          the resource bundles.
 
Fields inherited from class java.util.ResourceBundle
parent
 
Constructor Summary
HierarchicalResourceBundle()
          Creates a new and empty HierarchicalResourceBundle which must be filled via addBundle() afterwards.
HierarchicalResourceBundle(java.util.List l)
          Creates a new HierarchicalResourceBundle which contains the bundles in the given list.
HierarchicalResourceBundle(java.util.ResourceBundle[] rba)
          Creates a new HierarchicalResourceBundle which contains the bundles in the given array.
 
Method Summary
 void addBundle(java.util.ResourceBundle rb)
          Put an additional bundle behind all loaded bundles.
 void dropBundles()
          Drop all already loaded bundles and clean the complete list of available resources.
 java.util.Enumeration getKeys()
          Get the union of all available keys.
protected  java.lang.Object handleGetObject(java.lang.String key)
          Get the value for a key.
 boolean isEmpty()
          Returns whether this bundle is empty.
 void prependBundle(java.util.ResourceBundle rb)
          Put an additional bundle in front of all loaded bundles.
 java.lang.String toString()
           
 
Methods inherited from class java.util.ResourceBundle
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rbs

private java.util.List rbs
the resource bundles.

Constructor Detail

HierarchicalResourceBundle

public HierarchicalResourceBundle()
Creates a new and empty HierarchicalResourceBundle which must be filled via addBundle() afterwards.


HierarchicalResourceBundle

public HierarchicalResourceBundle(java.util.List l)
Creates a new HierarchicalResourceBundle which contains the bundles in the given list.


HierarchicalResourceBundle

public HierarchicalResourceBundle(java.util.ResourceBundle[] rba)
Creates a new HierarchicalResourceBundle which contains the bundles in the given array.

Method Detail

dropBundles

public void dropBundles()
Drop all already loaded bundles and clean the complete list of available resources. This operation is needed by implementations which allow the bundle to reload itself dynamically, e.g. after a global locale change.


prependBundle

public void prependBundle(java.util.ResourceBundle rb)
Put an additional bundle in front of all loaded bundles. The new bundles superceedes all already available bundles when it comes to equal keys.


addBundle

public void addBundle(java.util.ResourceBundle rb)
Put an additional bundle behind all loaded bundles. Any already loaded keys of the new bundle are hidden by the already loaded bundles.


getKeys

public java.util.Enumeration getKeys()
Get the union of all available keys.


handleGetObject

protected java.lang.Object handleGetObject(java.lang.String key)
                                    throws java.util.MissingResourceException
Get the value for a key. The loaded bundles are queried from small index to large index. Which one is queried first depends on whether it was loaded with prependBundle() or addBundle().

Throws:
java.util.MissingResourceException

isEmpty

public boolean isEmpty()
Returns whether this bundle is empty.


toString

public java.lang.String toString()

QJCC homepage