java.util
Class ResourceBundleHierarchy

java.lang.Object
  extended byjava.util.ResourceBundleHierarchy

public class ResourceBundleHierarchy
extends java.lang.Object

This class is used to access the protected parent field of a resource bundle, in order to determine where in the hierarchy a key is located.

Version:
$Revision: 1.1 $ $Date: 2006/08/11 00:17:59 $
Author:
garbiras
Created on:
June 13, 2006

Constructor Summary
ResourceBundleHierarchy()
           
 
Method Summary
static java.util.ResourceBundle getBundleForKey(java.lang.String key, java.util.ResourceBundle bundle)
          Starting with the specified ResourceBundle, checks for the argument key.
static java.util.Locale getLocaleForKey(java.lang.String key, java.util.ResourceBundle bundle)
          Starting with the specified ResourceBundle, checks for the argument key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleHierarchy

public ResourceBundleHierarchy()
Method Detail

getBundleForKey

public static java.util.ResourceBundle getBundleForKey(java.lang.String key,
                                                       java.util.ResourceBundle bundle)
Starting with the specified ResourceBundle, checks for the argument key. If the key is found, it recursively checks the parent bundle for the key. It returns the highest ResourceBundle for which the key returned the same value as the original call. It returns null if the key or bundle arguments are null, or if the key does not exist in the bundle

Parameters:
key - the property to hierarchically search for within the bundle
bundle - the ResourceBundle to inspect for the hierarchical placement of the key property
Returns:
the highest ResourceBundle within the hierarchy for which the key returned the same value as the call to the argument ResourceBundle

getLocaleForKey

public static java.util.Locale getLocaleForKey(java.lang.String key,
                                               java.util.ResourceBundle bundle)
Starting with the specified ResourceBundle, checks for the argument key. If the key is found, it recursively checks the parent bundle for the key. It returns the Locale of the highest ResourceBundle for which the key returned the same value as the original call. It returns null if the key or bundle arguments are null, or if the key does not exist in the bundle It is equivalent to calling ResourceBundleHierarchy.getBundleForKey(key, bundle).getLocale()

Parameters:
key - the property to hierarchically search for within the bundle
bundle - the ResourceBundle to inspect for the hierarchical placement of the key property
Returns:
the Locale of the highest ResourceBundle within the hierarchy for which the key returned the same value as the call to the argument ResourceBundle
See Also:
getBundleForKey(java.lang.String, java.util.ResourceBundle)