Build 1.0_r1(from source)

java.util
Class ResourceBundle

java.lang.Object
  extended by java.util.ResourceBundle
Direct Known Subclasses:
ListResourceBundle, PropertyResourceBundle, ResourceBundle.MissingBundle

public abstract class ResourceBundle
extends Object

ResourceBundle is an abstract class which is the superclass of classes which provide locale specific resources. A bundle contains a number of named resources, where the names are Strings. A bundle may have a parent bundle, when a resource is not found in a bundle, the parent bundle is searched for the resource.

Since:
1.1
See Also:
Properties, PropertyResourceBundle

Nested Class Summary
(package private) static class ResourceBundle.MissingBundle
           
 
Field Summary
protected  ResourceBundle parent
          The parent of this ResourceBundle.
 
Constructor Summary
ResourceBundle()
          Constructs a new instance of this class.
 
Method Summary
static ResourceBundle getBundle(String bundleName)
          Finds the named resource bundle for the default locale.
static ResourceBundle getBundle(String bundleName, Locale locale)
          Finds the named resource bundle for the specified locale.
static ResourceBundle getBundle(String bundleName, Locale locale, ClassLoader loader)
          Finds the named resource bundle for the specified locale.
abstract  Enumeration<String> getKeys()
          Returns the names of the resources contained in this ResourceBundle.
 Locale getLocale()
          Gets the Locale of this ResourceBundle.
 Object getObject(String key)
          Returns the named resource from this ResourceBundle.
 String getString(String key)
          Returns the named resource from this ResourceBundle.
 String[] getStringArray(String key)
          Returns the named resource from this ResourceBundle.
protected abstract  Object handleGetObject(String key)
          Returns the named resource from this ResourceBundle, or null if the resource is not found.
protected  void setParent(ResourceBundle bundle)
          Sets the parent resource bundle of this ResourceBundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected ResourceBundle parent
The parent of this ResourceBundle.

Constructor Detail

ResourceBundle

public ResourceBundle()
Constructs a new instance of this class.

Method Detail

getBundle

public static final ResourceBundle getBundle(String bundleName)
                                      throws MissingResourceException
Finds the named resource bundle for the default locale.

Parameters:
bundleName - the name of the resource bundle
Returns:
ResourceBundle
Throws:
MissingResourceException - when the resource bundle cannot be found

getBundle

public static final ResourceBundle getBundle(String bundleName,
                                             Locale locale)
Finds the named resource bundle for the specified locale.

Parameters:
bundleName - the name of the resource bundle
locale - the locale
Returns:
ResourceBundle
Throws:
MissingResourceException - when the resource bundle cannot be found

getBundle

public static ResourceBundle getBundle(String bundleName,
                                       Locale locale,
                                       ClassLoader loader)
                                throws MissingResourceException
Finds the named resource bundle for the specified locale.

Parameters:
bundleName - the name of the resource bundle
locale - the locale
loader - the ClassLoader to use
Returns:
ResourceBundle
Throws:
MissingResourceException - when the resource bundle cannot be found

getKeys

public abstract Enumeration<String> getKeys()
Returns the names of the resources contained in this ResourceBundle.

Returns:
an Enumeration of the resource names

getLocale

public Locale getLocale()
Gets the Locale of this ResourceBundle.

Returns:
the Locale of this ResourceBundle

getObject

public final Object getObject(String key)
Returns the named resource from this ResourceBundle.

Parameters:
key - the name of the resource
Returns:
the resource object
Throws:
MissingResourceException - when the resource is not found

getString

public final String getString(String key)
Returns the named resource from this ResourceBundle.

Parameters:
key - the name of the resource
Returns:
the resource string
Throws:
MissingResourceException - when the resource is not found

getStringArray

public final String[] getStringArray(String key)
Returns the named resource from this ResourceBundle.

Parameters:
key - the name of the resource
Returns:
the resource string array
Throws:
MissingResourceException - when the resource is not found

handleGetObject

protected abstract Object handleGetObject(String key)
Returns the named resource from this ResourceBundle, or null if the resource is not found.

Parameters:
key - the name of the resource
Returns:
the resource object

setParent

protected void setParent(ResourceBundle bundle)
Sets the parent resource bundle of this ResourceBundle. The parent is searched for resources which are not found in this resource bundle.

Parameters:
bundle - the parent resource bundle

Build 1.0_r1(from source)

Please submit a feedback, bug or feature