|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.excalibur.i18n.Resources
A class to simplify extracting localized strings, icons and other common resources from a ResourceBundle. Reworked to mirror behaviour of StringManager from Tomcat (format() to getString()).
Constructor Summary | |
Resources(String baseName)
Constructor that builds a manager in default locale. |
|
Resources(String baseName,
ClassLoader classLoader)
Constructor that builds a manager in default locale using specified ClassLoader. |
|
Resources(String baseName,
Locale locale)
Constructor that builds a manager in specified locale. |
|
Resources(String baseName,
Locale locale,
ClassLoader classLoader)
Constructor that builds a manager in specified locale. |
Method Summary | |
String |
format(String key,
Object[] args)
Retrieve a string from resource bundle and format it with specified args. |
boolean |
getBoolean(String key)
Retrieve a boolean from bundle. |
boolean |
getBoolean(String key,
boolean defaultValue)
Retrieve a boolean from bundle. |
ResourceBundle |
getBundle()
Retrieve underlying ResourceBundle. |
byte |
getByte(String key)
Retrieve a byte from bundle. |
byte |
getByte(String key,
byte defaultValue)
Retrieve a byte from bundle. |
char |
getChar(String key)
Retrieve a char from bundle. |
char |
getChar(String key,
char defaultValue)
Retrieve a char from bundle. |
Date |
getDate(String key)
Retrieve a date from bundle. |
Date |
getDate(String key,
Date defaultValue)
Retrieve a date from bundle. |
Date |
getDateTime(String key)
Retrieve a date + time from bundle. |
Date |
getDateTime(String key,
Date defaultValue)
Retrieve a time from bundle. |
double |
getDouble(String key)
Retrieve a double from bundle. |
double |
getDouble(String key,
double defaultValue)
Retrieve a double from bundle. |
float |
getFloat(String key)
Retrieve a float from bundle. |
float |
getFloat(String key,
float defaultValue)
Retrieve a float from bundle. |
int |
getInteger(String key)
Retrieve a integer from bundle. |
int |
getInteger(String key,
int defaultValue)
Retrieve a integer from bundle. |
long |
getLong(String key)
Retrieve a long from bundle. |
long |
getLong(String key,
long defaultValue)
Retrieve a long from bundle. |
short |
getShort(String key)
Retrieve a short from bundle. |
short |
getShort(String key,
short defaultValue)
Retrieve a short from bundle. |
String |
getString(String key)
Retrieve a raw string from bundle. |
String |
getString(String key,
Object arg1)
Retrieve a string from resource bundle and format it with specified args. |
String |
getString(String key,
Object arg1,
Object arg2)
Retrieve a string from resource bundle and format it with specified args. |
String |
getString(String key,
Object arg1,
Object arg2,
Object arg3)
Retrieve a string from resource bundle and format it with specified args. |
String |
getString(String key,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Retrieve a string from resource bundle and format it with specified args. |
String |
getString(String key,
Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5)
Retrieve a string from resource bundle and format it with specified args. |
Date |
getTime(String key)
Retrieve a time from bundle. |
Date |
getTime(String key,
Date defaultValue)
Retrieve a time from bundle. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Resources(String baseName)
baseName
- the base name of ResourceBundlepublic Resources(String baseName, ClassLoader classLoader)
baseName
- the base name of ResourceBundleclassLoader
- the classLoader to load ResourceBundle frompublic Resources(String baseName, Locale locale)
baseName
- the base name of ResourceBundlelocale
- the Locale for resource bundlepublic Resources(String baseName, Locale locale, ClassLoader classLoader)
baseName
- the base name of ResourceBundlelocale
- the Locale for resource bundleclassLoader
- the classLoader to load ResourceBundle fromMethod Detail |
public boolean getBoolean(String key, boolean defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic boolean getBoolean(String key) throws MissingResourceException
key
- the key of resourcepublic byte getByte(String key, byte defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic byte getByte(String key) throws MissingResourceException
key
- the key of resourcepublic char getChar(String key, char defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic char getChar(String key) throws MissingResourceException
key
- the key of resourcepublic short getShort(String key, short defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic short getShort(String key) throws MissingResourceException
key
- the key of resourcepublic int getInteger(String key, int defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic int getInteger(String key) throws MissingResourceException
key
- the key of resourcepublic long getLong(String key, long defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic long getLong(String key) throws MissingResourceException
key
- the key of resourcepublic float getFloat(String key, float defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic float getFloat(String key) throws MissingResourceException
key
- the key of resourcepublic double getDouble(String key, double defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic double getDouble(String key) throws MissingResourceException
key
- the key of resourcepublic Date getDate(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic Date getDate(String key) throws MissingResourceException
key
- the key of resourcepublic Date getTime(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic Date getTime(String key) throws MissingResourceException
key
- the key of resourcepublic Date getDateTime(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingpublic Date getDateTime(String key) throws MissingResourceException
key
- the key of resourcepublic String getString(String key) throws MissingResourceException
key
- the key of resourcepublic String getString(String key, Object arg1)
key
- the key for resourcearg1
- an argpublic String getString(String key, Object arg1, Object arg2)
key
- the key for resourcearg1
- an argarg2
- an argpublic String getString(String key, Object arg1, Object arg2, Object arg3)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argpublic String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argarg4
- an argpublic String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argarg4
- an argarg5
- an argpublic String format(String key, Object[] args)
key
- the key for resourceargs
- an array of argspublic final ResourceBundle getBundle() throws MissingResourceException
MissingResourceException
- if an error occurs
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |