|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ops4j.util.i18n.Resources
public final 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(java.lang.String baseName)
Constructor that builds a manager in default locale. |
|
Resources(java.lang.String baseName,
java.lang.ClassLoader classLoader)
Constructor that builds a manager in default locale using specified ClassLoader. |
|
Resources(java.lang.String baseName,
java.util.Locale locale)
Constructor that builds a manager in specified locale. |
|
Resources(java.lang.String baseName,
java.util.Locale locale,
java.lang.ClassLoader classLoader)
Constructor that builds a manager in specified locale. |
|
| Method Summary | |
|---|---|
java.lang.String |
format(java.lang.String key,
java.lang.Object[] args)
Retrieve a string from resource bundle and format it with specified args. |
boolean |
getBoolean(java.lang.String key)
Retrieve a boolean from bundle. |
boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Retrieve a boolean from bundle. |
java.util.ResourceBundle |
getBundle()
Retrieve underlying ResourceBundle. |
byte |
getByte(java.lang.String key)
Retrieve a byte from bundle. |
byte |
getByte(java.lang.String key,
byte defaultValue)
Retrieve a byte from bundle. |
char |
getChar(java.lang.String key)
Retrieve a char from bundle. |
char |
getChar(java.lang.String key,
char defaultValue)
Retrieve a char from bundle. |
java.util.Date |
getDate(java.lang.String key)
Retrieve a date from bundle. |
java.util.Date |
getDate(java.lang.String key,
java.util.Date defaultValue)
Retrieve a date from bundle. |
java.util.Date |
getDateTime(java.lang.String key)
Retrieve a date + time from bundle. |
java.util.Date |
getDateTime(java.lang.String key,
java.util.Date defaultValue)
Retrieve a time from bundle. |
double |
getDouble(java.lang.String key)
Retrieve a double from bundle. |
double |
getDouble(java.lang.String key,
double defaultValue)
Retrieve a double from bundle. |
float |
getFloat(java.lang.String key)
Retrieve a float from bundle. |
float |
getFloat(java.lang.String key,
float defaultValue)
Retrieve a float from bundle. |
int |
getInteger(java.lang.String key)
Retrieve a integer from bundle. |
int |
getInteger(java.lang.String key,
int defaultValue)
Retrieve a integer from bundle. |
long |
getLong(java.lang.String key)
Retrieve a long from bundle. |
long |
getLong(java.lang.String key,
long defaultValue)
Retrieve a long from bundle. |
short |
getShort(java.lang.String key)
Retrieve a short from bundle. |
short |
getShort(java.lang.String key,
short defaultValue)
Retrieve a short from bundle. |
java.lang.String |
getString(java.lang.String key)
Retrieve a raw string from bundle. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6)
Retrieve a string from resource bundle and format it with specified args. |
java.lang.String |
getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7)
Retrieve a string from resource bundle and format it with specified args. |
java.util.Date |
getTime(java.lang.String key)
Retrieve a time from bundle. |
java.util.Date |
getTime(java.lang.String key,
java.util.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(java.lang.String baseName)
baseName - the base name of ResourceBundle
public Resources(java.lang.String baseName,
java.lang.ClassLoader classLoader)
baseName - the base name of ResourceBundleclassLoader - the classLoader to load ResourceBundle from
public Resources(java.lang.String baseName,
java.util.Locale locale)
baseName - the base name of ResourceBundlelocale - the Locale for resource bundle
public Resources(java.lang.String baseName,
java.util.Locale locale,
java.lang.ClassLoader classLoader)
baseName - the base name of ResourceBundlelocale - the Locale for resource bundleclassLoader - the classLoader to load ResourceBundle from| Method Detail |
|---|
public boolean getBoolean(java.lang.String key,
boolean defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public boolean getBoolean(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public byte getByte(java.lang.String key,
byte defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public byte getByte(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public char getChar(java.lang.String key,
char defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public char getChar(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public short getShort(java.lang.String key,
short defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public short getShort(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public int getInteger(java.lang.String key,
int defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public int getInteger(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public long getLong(java.lang.String key,
long defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public long getLong(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public float getFloat(java.lang.String key,
float defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public float getFloat(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public double getDouble(java.lang.String key,
double defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public double getDouble(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getDate(java.lang.String key,
java.util.Date defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getDate(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getTime(java.lang.String key,
java.util.Date defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getTime(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getDateTime(java.lang.String key,
java.util.Date defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missing
java.util.MissingResourceException - if the requested key is unknown
public java.util.Date getDateTime(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public java.lang.String getString(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resource
java.util.MissingResourceException - if the requested key is unknown
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1)
key - the key for resourcearg1 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
key - the key for resourcearg1 - an argarg2 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
key - the key for resourcearg1 - an argarg2 - an argarg3 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
key - the key for resourcearg1 - an argarg2 - an argarg3 - an argarg4 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5)
key - the key for resourcearg1 - an argarg2 - an argarg3 - an argarg4 - an argarg5 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6)
key - the key for resourcearg1 - an argarg2 - an argarg3 - an argarg4 - an argarg5 - an argarg6 - an arg
public java.lang.String getString(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4,
java.lang.Object arg5,
java.lang.Object arg6,
java.lang.Object arg7)
key - the key for resourcearg1 - an argarg2 - an argarg3 - an argarg4 - an argarg5 - an argarg6 - an argarg7 - an arg
public java.lang.String format(java.lang.String key,
java.lang.Object[] args)
key - the key for resourceargs - an array of args
public java.util.ResourceBundle getBundle()
throws java.util.MissingResourceException
java.util.MissingResourceException - if an error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||