Class ChainedResourceBundle


public class ChainedResourceBundle extends PropertyResourceBundle
ChainedResourceBundle allows chaining multiple resource bundles. If a resource is not found in a bundle its parent is automatically searched for the same resource.
Author:
Max Spivak
  • Constructor Details

  • Method Details

    • getBundle

      public static ResourceBundle getBundle(String res, ClassLoader classLoader) throws MissingResourceException
      Load and return specified resource bundle using specified class loader.
      Parameters:
      res - Fully-qualified name of the resource bundle, i.e. com.portal.app.someapp.MyResources
      classLoader - The classloader that should be used to load the resource bundle. In most cases it should be the caller's class loader which can be obtained by calling this.getClass().getClassLoader(). Value should not be null.
      Returns:
      ChainedResourceBundle
      Throws:
      MissingResourceException - if the bundle can't be loaded
    • getBundle

      public static ResourceBundle getBundle(ResourceBundle parent, String res, ClassLoader classLoader) throws MissingResourceException
      Load and return specified resource bundle using specified class loader. The specified parent resource bundle is set as the parent of the returned bundle.
      Parameters:
      parent - ResourceBundle that is set as the parent of the returned bundle.
      res - Fully-qualified name of the resource bundle, i.e. com.portal.app.someapp.MyResources
      classLoader - The classloader that should be used to load the resource bundle. In most cases it should be the caller's class loader which can be obtained by calling this.getClass().getClassLoader(). Value should not be null.
      Returns:
      ChainedResourceBundle
      Throws:
      MissingResourceException - if the bundle can't be loaded
    • getBundle

      public static ResourceBundle getBundle(ResourceBundle parent, String res, Locale loc) throws MissingResourceException
      Load and return specified resource bundle for the specified locale. The specified parent resource bundle is set as the parent of the returned bundle.
      Parameters:
      parent - ResourceBundle that is set as the parent of the returned bundle.
      res - Fully-qualified name of the resource bundle, i.e. com.portal.app.someapp.MyResources
      loc - The locale for which the resource bundle will be loaded.
      Returns:
      ChainedResourceBundle
      Throws:
      MissingResourceException - if the bundle can't be loaded
    • getBundle

      public static ResourceBundle getBundle(ResourceBundle parent, String res, Locale loc, ClassLoader classLoader) throws MissingResourceException
      Load and return specified resource bundle for the specified locale. Use the specified classloader to load the resource. The specified parent resource bundle is set as the parent of the returned bundle.
      Parameters:
      parent - ResourceBundle that is set as the parent of the returned bundle.
      res - Fully-qualified name of the resource bundle, i.e. com.portal.app.someapp.MyResources
      loc - The locale for which the resource bundle will be loaded.
      classLoader - The classloader that should be used to load the resource bundle. In most cases it should be the caller's class loader which can be obtained by calling this.getClass().getClassLoader(). Value should not be null.
      Returns:
      ChainedResourceBundle
      Throws:
      MissingResourceException - if the bundle can't be loaded
    • setParent

      public void setParent(ResourceBundle rb)
      Overrides:
      setParent in class ResourceBundle
      Parameters:
      rb -
    • getParent

      public ResourceBundle getParent()
      Returns: