java.lang.Object
io.sf.jclf.util.FormattedResourceBundle
A resource bundle that contains
MessageFormat
strings.
If a given message does not contain a format, then a String is directly bundled.
Methods are analog to the ones in ResourceBundle
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionformatString
(String key, int i) formatString
(String key, Object[] o) Formats an array of objects according to a MessageFormat identified bykey
.formatString
(String key, String arg) Formats a message according to a MessageFormat and a String argument.formatString
(String key, String arg, int i) Formats a message according to a MessageFormat, a String argument and an integer argument.formatString
(String key, String arg1, String arg2) Formats a message according to a MessageFormat and two String arguments.getKeys()
Gets an enumeration of bundle keys.static FormattedResourceBundle
getLocalBundle
(String baseName) Get the appropriate FormattedResourceBundle class.static FormattedResourceBundle
getLocalBundle
(String baseName, Locale locale) Get the appropriate FormattedResourceBundle class.static FormattedResourceBundle
getLocalBundle
(String baseName, Locale locale, ClassLoader loader) Get the appropriate FormattedResourceBundle subclass.Gets the MessageFormat pattern, or the plain String value, associated to a given key.void
setParent
(FormattedResourceBundle parent) Sets the parent for this resource bundle.
-
Method Details
-
getString
Gets the MessageFormat pattern, or the plain String value, associated to a given key.- Parameters:
key
- the bundle key.- Returns:
- the associated MessageFormat pattern, or the plain String value.
-
formatString
Formats a message according to a MessageFormat and a String argument.- Parameters:
key
- the bundle key.arg
- the String argument to be used for the MessageFormat.- Returns:
- the formatted String, see class description.
-
formatString
Formats a message according to a MessageFormat and two String arguments.- Parameters:
key
- the bundle key.arg1
- the first String argument to be used for the MessageFormat.arg2
- the second String argument to be used for the MessageFormat.- Returns:
- the formatted String, see class description.
-
formatString
Formats a message according to a MessageFormat, a String argument and an integer argument.- Parameters:
key
- the bundle key.arg
- the String argument to be used for the MessageFormat.i
- the integer argument to be used for the MessageFormat.- Returns:
- the formatted String, see class description.
-
formatString
Formats an array of objects according to a MessageFormat identified bykey
.- Parameters:
key
- the bundle key.o
- the array to be formatted.- Returns:
- the formatted String, see class description.
-
formatString
- Parameters:
key
- the bundle key.i
- the integer to be formatted.- Returns:
- the formatted String, see class description.
-
setParent
Sets the parent for this resource bundle.- Parameters:
parent
- the parent bundle.
-
getKeys
Gets an enumeration of bundle keys.- Returns:
- the keys enumeration.
-
getLocalBundle
public static FormattedResourceBundle getLocalBundle(String baseName) throws MissingResourceException Get the appropriate FormattedResourceBundle class.- Parameters:
baseName
- see class description.- Returns:
- the resource bundle.
- Throws:
MissingResourceException
-
getLocalBundle
Get the appropriate FormattedResourceBundle class.- Parameters:
baseName
- see class description.locale
- see class description.- Returns:
- the resource bundle.
-
getLocalBundle
public static FormattedResourceBundle getLocalBundle(String baseName, Locale locale, ClassLoader loader) throws MissingResourceException Get the appropriate FormattedResourceBundle subclass.- Parameters:
baseName
- see class description.locale
- see class description.loader
- the ClassLoader to load the resource from- Returns:
- the resource bundle.
- Throws:
MissingResourceException
-