XResourceBundle
org.clapper.util.misc

Class XResourceBundle



  • public final class XResourceBundleextends ResourceBundle
    This class is an extended version of the JDK's ResourceBundle class, providing some extra methods. It can be instantiated by wrapping an existing ResourceBundle object, or by using the static getBundle() methods, which are identical to the ResourceBundle versions.
    • Constructor Detail

      • XResourceBundle

        public XResourceBundle(ResourceBundle bundle)
        Create a new XResourceBundle that wraps an existing ResourceBundle.
        Parameters:
        bundle - the ResourceBundle to wrap.
    • Method Detail

      • getXResourceBundle

        public static XResourceBundle getXResourceBundle(String baseName)
        Analogous to the equivalent getBundle method in the JDK's ResourceBundle class.
        Parameters:
        baseName - base name of the bundle to retrieve, a fully qualified class name
        Returns:
        the bundle
        Throws:
        NullPointerException - if baseName is null
        MissingResourceException - no bundle available
      • getXResourceBundle

        public static XResourceBundle getXResourceBundle(String baseName,                                 Locale locale)
        Analogous to the equivalent getBundle method in the JDK's ResourceBundle class.
        Parameters:
        baseName - base name of the bundle to retrieve, a fully qualified class name
        locale - the locale for which a resource bundle is desired
        Returns:
        the bundle
        Throws:
        NullPointerException - if baseName is null
        MissingResourceException - no bundle available
      • getXResourceBundle

        public static XResourceBundle getXResourceBundle(String baseName,                                 Locale locale,                                 ClassLoader classLoader)
        Analogous to the equivalent getBundle method in the JDK's ResourceBundle class.
        Parameters:
        baseName - base name of the bundle to retrieve, a fully qualified class name
        locale - the locale for which a resource bundle is desired
        classLoader - class loader to use
        Returns:
        the bundle
        Throws:
        NullPointerException - if baseName is null
        MissingResourceException - no bundle available
      • getString

        public String getString(String key,               String defaultValue)
        Get a string for the given key from this resource bundle, applying a default if not found. There's no equivalent for this method in the ResourceBundle class.
        Parameters:
        key - the key for the desired string
        defaultValue - the default value, if not found
        Returns:
        the value for the key, which may be the default

SCaVis 2.0 © jWork.ORG