|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.i18n.ResourceBundle
public abstract class ResourceBundle
Defines base functionality for bundles of locale-specific resources.
Compatible with java.util.ResourceBundle in Java's standard edition.
Constructor Summary | ||
---|---|---|
protected |
ResourceBundle(Locale locale)
Constructs a new ResourceBundle instance. |
Method Summary | ||
---|---|---|
static ResourceBundleFamily |
getBundle(String name)
Retrieves resource bundle family by name. |
|
static ResourceBundleFamily |
getBundle(long bundle,
String name)
Retrieves resource bundle family by ID. |
|
static ResourceBundleFamily |
getBundle(long bundle,
String name,
CodeSigningKey key)
Retrieves resource bundle family by ID. |
|
ResourceBundleFamily |
getFamily()
Retrieves this bundle's family. |
|
Locale |
getLocale()
Retrieves this bundle's locale. |
|
Object |
getObject(int key)
Retrieves resource object by key (will chain through parent bundles). |
|
Object |
getObject(int key,
boolean searchParent)
Retrieves resource object by key. |
|
String |
getString(int key)
Retrieves string form of resource object by key. |
|
String[] |
getStringArray(int key)
Retrieves string array form of resource object by key. |
|
protected abstract Object |
handleGetObject(int key)
Retrieves resource object handle by integer key. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ResourceBundle(Locale locale)
locale
- Locale for this resource bundle.Method Detail |
---|
public static final ResourceBundleFamily getBundle(String name)
name
- Name for the resource bundle family.
public static final ResourceBundleFamily getBundle(long bundle, String name) throws IllegalArgumentException
Invoke this method to retrieve the resource bundle family with the provided bundle ID. If this bundle family doesn't exist, then this method creates a new resource bundle family with your provided ID and name, and returns that.
bundle
- Bundle ID.name
- Name for the resource bundle family.
IllegalArgumentException
- If the name or its hash is not valid.public static final ResourceBundleFamily getBundle(long bundle, String name, CodeSigningKey key) throws IllegalArgumentException
Invoke this method to retrieve the resource bundle family with the provided bundle ID. If this bundle family doesn't exist, then this method creates a new resource bundle family with your provided ID and name, and returns that.
bundle
- Bundle ID.name
- Name for the resource bundle family.
IllegalArgumentException
- If the name or its hash is not valid.public final ResourceBundleFamily getFamily()
public final Locale getLocale()
public final Object getObject(int key) throws MissingResourceException
This method simply invokes
getObject(key,true)
. Thus, invoking this
method on a derived class prompts the method to invoke
this method on the enclosing bundle parent if the object is not found in
this bundle. If the object is never found through the entire chain of
calls on parent objects, then this method throws an exception.
key
- Key for searched-for resource object.
MissingResourceException
- If neither this bundle (nor any enclosing parent
bundle) contains the resource associated with provided key.public final Object getObject(int key, boolean searchParent)
key
- Key for searched-for resource object.searchParent
- If true, and if this bundle does not contain the
resource object, this method will look in the enclosing bundle parent for
the object, and will chain outwards through enclosing bundles until
either the object is found, or the outmost bundle is reached. If False,
this method stops looking after searching this bundle.
public final String getString(int key) throws MissingResourceException
This method merely casts the return value of
ResourceBundle.getObject(int)
as a String.
key
- Key for searched-for resource object.
MissingResourceException
- If neither this bundle (nor any enclosing parent
bundle) contains the resource associated with provided key.public final String[] getStringArray(int key) throws MissingResourceException
This method merely casts the return value of
ResourceBundle.getObject(int)
as a String array.
key
- Key for searched-for resource object.
MissingResourceException
- If neither this bundle (nor any enclosing parent
bundle) contains the resource associated with provided key.protected abstract Object handleGetObject(int key) throws MissingResourceException
Subclasses must implement this to return the appropriate resource object for a given key.
key
- Integer key associated with resource object.
MissingResourceException
- If the object associated with key not found.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal