|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.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()).
| Field Summary | |
private java.lang.String |
m_baseName |
private java.util.ResourceBundle |
m_bundle |
private java.lang.ClassLoader |
m_classLoader |
private java.util.Locale |
m_locale |
private static java.util.Random |
RANDOM |
| 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. |
private java.lang.String |
getPatternString(java.lang.String key)Utility method to retrieve a string from ResourceBundle. |
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 |
| Field Detail |
private static final java.util.Random RANDOM
private final java.util.Locale m_locale
private java.util.ResourceBundle m_bundle
private java.lang.String m_baseName
private java.lang.ClassLoader m_classLoader
| 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 missingjava.util.MissingResourceException
public boolean getBoolean(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public byte getByte(java.lang.String key,
byte defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public byte getByte(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public char getChar(java.lang.String key,
char defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public char getChar(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public short getShort(java.lang.String key,
short defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public short getShort(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public int getInteger(java.lang.String key,
int defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public int getInteger(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public long getLong(java.lang.String key,
long defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public long getLong(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public float getFloat(java.lang.String key,
float defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public float getFloat(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public double getDouble(java.lang.String key,
double defaultValue)
throws java.util.MissingResourceException
key - the key of resourcedefaultValue - the default value if key is missingjava.util.MissingResourceException
public double getDouble(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
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 missingjava.util.MissingResourceException
public java.util.Date getDate(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
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 missingjava.util.MissingResourceException
public java.util.Date getTime(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
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 missingjava.util.MissingResourceException
public java.util.Date getDateTime(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
public java.lang.String getString(java.lang.String key)
throws java.util.MissingResourceException
key - the key of resourcejava.util.MissingResourceException
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 final java.util.ResourceBundle getBundle()
throws java.util.MissingResourceException
java.util.MissingResourceException - if an error occurs
private java.lang.String getPatternString(java.lang.String key)
throws java.util.MissingResourceException
key - the key to resourcejava.util.MissingResourceException - if an error occurs
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||