|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.resources.BundleHandler
A ResourceBundle helper class.
Allows clients to get/set locale and get at localized resource bundle content in a resource path independent manner, without having to worry about handling exception states or deal directly with ResourceBundle object instances. Instead, clients recieve numeric handles to the underlying objects. Rather than causing exception states, missing or inaccessible resources and underlying MissingResource and NullPointer exceptions result in null return values when attempting to retrieve a resource.
Method Summary | |
static ResourceBundle |
getBundle(String name,
Locale locale,
ClassLoader cl)
Retrieves a resource bundle using the specified base name, locale, and class loader. |
static int |
getBundleHandle(String name,
ClassLoader cl)
Retrieves an int handle to the ResourceBundle
object corresponding to the specified name and current
Locale , using the specified ClassLoader . |
static Locale |
getLocale()
Getter for property locale. |
static String |
getString(int handle,
String key)
Retrieves, from the ResourceBundle object corresponding
to the specified handle, the String value corresponding
to the specified key. |
static void |
setLocale(Locale l)
Setter for property locale. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static Locale getLocale()
public static void setLocale(Locale l) throws IllegalArgumentException
l
- the new locale
IllegalArgumentException
- when the new locale is nullpublic static int getBundleHandle(String name, ClassLoader cl)
int
handle to the ResourceBundle
object corresponding to the specified name and current
Locale
, using the specified ClassLoader
.
cl
- The ClassLoader to use in the searchname
- of the desired bundle
int
handle to the ResourceBundle
object corresponding to the specified name and
current Locale
, or -1 if no such bundle
can be foundpublic static String getString(int handle, String key)
ResourceBundle
object corresponding
to the specified handle, the String
value corresponding
to the specified key. null
is retrieved if either there
is no ResourceBundle
object for the handle or there is no
String
value for the specified key.
handle
- an int
handle to a
ResourceBundle
objectkey
- A String
key to a String
value
public static ResourceBundle getBundle(String name, Locale locale, ClassLoader cl) throws NullPointerException, MissingResourceException
name
- the base name of the resource bundle, a fully
qualified class namelocale
- the locale for which a resource bundle is desiredcl
- the class loader from which to load the resource bundle
NullPointerException
MissingResourceException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |