|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.dpml.i18n.Resources
public class 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. |
String |
getString(String key,
Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6)
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,
Object arg6,
Object arg7)
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 missing
MissingResourceException
- if the requested key is unknownpublic boolean getBoolean(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic byte getByte(String key, byte defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic byte getByte(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic char getChar(String key, char defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic char getChar(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic short getShort(String key, short defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic short getShort(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic int getInteger(String key, int defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic int getInteger(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic long getLong(String key, long defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic long getLong(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic float getFloat(String key, float defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic float getFloat(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic double getDouble(String key, double defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic double getDouble(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic Date getDate(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic Date getDate(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic Date getTime(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic Date getTime(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic Date getDateTime(String key, Date defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missing
MissingResourceException
- if the requested key is unknownpublic Date getDateTime(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic String getString(String key) throws MissingResourceException
key
- the key of resource
MissingResourceException
- if the requested key is unknownpublic String getString(String key, Object arg1)
key
- the key for resourcearg1
- an arg
public String getString(String key, Object arg1, Object arg2)
key
- the key for resourcearg1
- an argarg2
- an arg
public String getString(String key, Object arg1, Object arg2, Object arg3)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an arg
public String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argarg4
- an arg
public 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 arg
public String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argarg4
- an argarg5
- an argarg6
- an arg
public String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7)
key
- the key for resourcearg1
- an argarg2
- an argarg3
- an argarg4
- an argarg5
- an argarg6
- an argarg7
- an arg
public String format(String key, Object[] args)
key
- the key for resourceargs
- an array of args
public final ResourceBundle getBundle() throws MissingResourceException
MissingResourceException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |