public final class Resources extends Object
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 frompublic boolean getBoolean(String key, boolean defaultValue) throws MissingResourceException
key
- the key of resourcedefaultValue
- the default value if key is missingMissingResourceException
- if the requested key is unknownpublic boolean getBoolean(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic byte getByte(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic char getChar(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic short getShort(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic int getInteger(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic long getLong(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic float getFloat(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic double getDouble(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic Date getDate(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic Date getTime(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- 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 missingMissingResourceException
- if the requested key is unknownpublic Date getDateTime(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- if the requested key is unknownpublic String getString(String key) throws MissingResourceException
key
- the key of resourceMissingResourceException
- if the requested key is unknownpublic 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 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 argpublic 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 argpublic String format(String key, Object[] args)
key
- the key for resourceargs
- an array of argspublic ResourceBundle getBundle() throws MissingResourceException
MissingResourceException
- if an error occursCopyright © 2006–2019 OPS4J - Open Participation Software for Java. All rights reserved.