The ResourceBundle class has 18 methods, each described here:
- clearCache():
public static final void clearCache()
As you can see from the following table, the clearCache() method does not throw any exceptions, does not take any parameters, and has no return value:
Component | Details |
Throws | None |
Parameters | None |
Returns | None |
Here is a version of the clearCache() method that takes ClassLoader as a parameter:
public static final void clearCache(ClassLoader loader)
Here are the details of the version of the clearCache() method that takes a ClassLoader as a parameter:
Component | Details |
Throws | NullPointerException (if loader is null) |
Parameters | loader: The class loader |
Returns | None |
- containsKey():
public boolean containsKey(String key)
Let's look at the details for the containsKey() method:
Component | Details |
Throws | NullPointerException (if key is null) |
Parameters | key: Resource key |
Returns | true/false depending on if key is in ResourceBundle or parent bundles |
- getBundle():
public static final ResourceBundle getBundle(String baseName)
Let's look at the details for the first version getBundle() method:
Component | Details |
Throws |
|
Parameters | baseName: Fully qualified class name |
Returns | Resource bundle based on the given baseName and the default locale |
The following is the syntax for the second version of the getBundle() method:
public static final ResourceBundle getBundle(String baseName, Resourcebundle.Control control)
Let's look at the details for the second version of the getBundle() method:
Component | Details |
Throws |
|
Parameters |
|
Returns | Resource bundle based on the given baseName and the default locale |
The following is the syntax for the third version of the getBundle() method:
public static final ResourceBundle getBundle(String baseName, Locale locale)
Let's look at the details for the third version of the getBundle() method:
Component | Details |
Throws |
|
Parameters |
|
Returns | Resource bundle based on the given baseName and locale |
The following is the syntax for the fourth version of the getBundle() method:
public static final ResourceBundle getBundle(String baseName, Locale targetLocale, Resourcebundle.Control control)
Let's look at the details for the fourth version of the getBundle() method:
Component | Details |
Throws |
|
Parameters |
|
Returns | Resource bundle based on the given baseName and locale |
The following is the syntax for the fifth version of the getBundle() method:
public static final ResourceBundle getBundle(String baseName, Locale locale, ClassLoader loader)
Let's look at the details for the fifth version of the getBundle() method:
Component | Details |
Throws |
|
Parameters |
|
Returns | Resource bundle based on the given baseName and locale |
The following is the syntax for the sixth version of the getBundle() method:
public static final ResourceBundle getBundle(String baseName, Locale targetLocale, ClassLoader loader, ResourceBundle.Control control)
Let's look at the details for the sixth version of the getBundle() method:
Component | Details |
Throws |
|
Parameters |
|
Returns | Resource bundle based on the given baseName and locale |
- getKeys():
public abstract Enumeration<String> getKeys()
Let's look at the details for the Enumeration() method:
Component | Details |
Throws | None |
Parameters | None |
Returns | Enumeration of keys in ResourceBundle and parent bundles |
- getLocale():
public Locale getLocale()
Let's look at the details for the getLocale() method:
Component | Details |
Throws | None |
Parameters | None |
Returns | The locale of the current resource bundle |
- getObject():
public final Object getObject(String key)
Let's look at the details for the getObject() method:
Component | Details |
Throws |
|
Parameters | key: This is key for the desired object |
Returns | The object for key provided |
- getString():
public final String getString(String key)
Let's look at the details for the getString() method:
Component | Details |
Throws |
|
Parameters | key: This is the key for the desired String |
Returns | String for the key provided |
- getStringArray():
public final String[] getStringArray(String key)
Let's look at the details for the getStringArray() method:
Component | Details |
Throws |
|
Parameters | key: This is the key for the desired String array |
Returns | The String array for the key provided |
- handleGetObject():
protected abstract Object handleGetObject(String key)
Let's look at the details for the handleGetObject() method:
Component | Details |
Throws | NullPointerException (if key is null) |
Parameters | key: key for the desired Object |
Returns | The object for the given key |
- handleKeySet():
protected Set<String> handleKeySet()
Let's look at the details for the handleKeySet() method:
Component | Details |
Throws | None |
Parameters | None |
Returns | Set of keys in ResourceBundle |
- keySet():
public Set<String> keySet()
Let's look at the details for the keySet() method:
Component | Details |
Throws | None |
Parameters | None |
Returns | Set of keys in ResourceBundle and its parent bundles |
- setParent():
protected void setParent(ResourceBundle parent)
Let's look at the details for the setParent() method:
Component | Details |
Throws | None |
Parameters | parent: The parent bundle for the current bundle |
Returns | None |