Skip navigation links
oracle.jbo.common
Class ArrayResourceBundle
java.lang.Object
java.util.ResourceBundle
oracle.jbo.common.ArrayResourceBundle
-
public abstract class ArrayResourceBundle
- extends java.util.ResourceBundle
ArrayResourceBundle
is an abstract subclass of ResourceBundle
that manages locale-dependent resources in an array. By using numeric references rather than string references, it requires less overhead and provides better performance than ListResourceBundle
and PropertyResourceBundle
. See ResourceBundle
for more information about resource bundles in general.
Subclasses must override getContents
and provide an array, where each item in the array is the resource value. The key for each resource value is its numeric offset in the array. For example, the first element in the array has the key 0. It may be retrieved by using either getObject(0) or getObject("0");
Unlike ListResourceBundle and PropertyResourceBundle, where each locale-specific variation of a bundle can override only selected resources, with ArrayResourceBundle, each variation must provide the complete set of Resources. For example,if MyResources has three resources, then MyResources_ja and MyResources_fr must also have three resources.
The following example shows the structure of a ResourceBundle based on ArrayResourceBundle.
class MyResources extends ArrayResourceBundle {
private static final Object[] contents = {
// LOCALIZE THIS
"Yes", // Label for the YES button
"No", // Label for the NO button
"Cancel" // Label for the CANCEL button
// END OF MATERIAL TO LOCALIZE
};
protected Object[] getContents() {
return contents;
}
}
- See Also:
ResourceBundle
, ListResourceBundle
, PropertyResourceBundle
Nested classes/interfaces inherited from class java.util.ResourceBundle |
java.util.ResourceBundle.Control |
Field Summary |
protected java.lang.Object[] |
contents
|
Fields inherited from class java.util.ResourceBundle |
parent |
Method Summary |
protected abstract java.lang.Object[] |
getContents()
|
java.util.Enumeration |
getKeys()
|
java.lang.Object |
getObject(int key)
Get an object from an ArrayResourceBundle. |
java.lang.String[] |
getStringArray(int key)
Get an object from an ArrayResourceBundle. |
protected java.lang.Object |
handleGetObject(java.lang.String key)
|
Methods inherited from class java.util.ResourceBundle |
clearCache, clearCache, containsKey, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
contents
protected java.lang.Object[] contents
ArrayResourceBundle
public ArrayResourceBundle()
getStringArray
public final java.lang.String[] getStringArray(int key)
- Get an object from an ArrayResourceBundle.
Convenience method to save casting.
-
- Parameters:
key
- see class description.
getObject
public final java.lang.Object getObject(int key)
- Get an object from an ArrayResourceBundle.
-
- Parameters:
key
- see class description. ###
getContents
protected abstract java.lang.Object[] getContents()
getKeys
public final java.util.Enumeration getKeys()
-
- Specified by:
getKeys
in class java.util.ResourceBundle
handleGetObject
protected java.lang.Object handleGetObject(java.lang.String key)
-
- Specified by:
handleGetObject
in class java.util.ResourceBundle
Skip navigation links
Copyright © 1997, 2011, Oracle. All rights reserved.