oracle.dacf.util
Class OracleResourceBundle
java.lang.Object
|
+--java.util.ResourceBundle
|
+--oracle.dacf.util.OracleResourceBundle
- public abstract class OracleResourceBundle
- extends java.util.ResourceBundle
OracleResourceBundle
is a 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
PropertyResourceBundle
and ListResourceBundle
.
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 OracleResourceBundle, 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 OracleResourceBundle.
class MyResource extends OracleResourceBundle {
public Object[] getContents() {
return contents;
}
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
};
}
- See Also:
ResourceBundle
,
ListResourceBundle
,
PropertyResourceBundle
Fields inherited from class java.util.ResourceBundle |
parent |
Method Summary |
protected abstract java.lang.Object[] |
getContents()
See class description. |
java.util.Enumeration |
getKeys()
Return an enumeration of the keys. |
java.lang.Object |
getObject(int index)
Get an object from a ResourceBundle. |
java.lang.String |
getString(int key)
Get a String from an OracleResourceBundle. |
java.lang.String[] |
getStringArray(int key)
Get an String array from a ResourceBundle. |
protected java.lang.Object |
handleGetObject(java.lang.String key)
|
Methods inherited from class java.util.ResourceBundle |
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OracleResourceBundle
public OracleResourceBundle()
getString
public final java.lang.String getString(int key)
throws java.util.MissingResourceException
- Get a String from an OracleResourceBundle.
Convenience method to save casting.
- Parameters:
key
- see class description.- Returns:
- the requested String
getStringArray
public final java.lang.String[] getStringArray(int key)
throws java.util.MissingResourceException
- Get an String array from a ResourceBundle.
Convenience method to save casting.
- Parameters:
key
- see class description.- Returns:
- the requested String array
getContents
protected abstract java.lang.Object[] getContents()
- See class description.
handleGetObject
protected java.lang.Object handleGetObject(java.lang.String key)
- Overrides:
handleGetObject
in class java.util.ResourceBundle
getObject
public java.lang.Object getObject(int index)
- Get an object from a ResourceBundle.
- Parameters:
key
- see class description.- Returns:
- the requested object
getKeys
public java.util.Enumeration getKeys()
- Return an enumeration of the keys.
- Overrides:
getKeys
in class java.util.ResourceBundle
- Returns:
- the enumeration object that can be used to walk the keys.