public class MessageBundle
extends java.lang.Object
implements java.io.Serializable
ResourceBundle
.Modifier and Type | Field and Description |
---|---|
private java.util.ResourceBundle |
ivResourceBundle
The resource bundle created by the constructor.
|
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
MessageBundle(java.util.ResourceBundle bundle)
Creates an instance of
MessageBundle for the specified
resource bundle. |
MessageBundle(java.lang.String bundleName)
Creates an instance of
MessageBundle for the specified
resource bundle name. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMessage(java.lang.String msgid)
Returns the message for a given message id.
|
java.lang.String |
getMessage(java.lang.String msgid,
java.lang.String... values)
Returns the message text for a given message id with the given set of
substitution value(s) inserted into the message text.
|
private java.lang.String |
getString(java.lang.String key)
Returns the resource string for a given resource key.
|
private static final long serialVersionUID
private java.util.ResourceBundle ivResourceBundle
public MessageBundle(java.lang.String bundleName)
MessageBundle
for the specified
resource bundle name.bundleName
- (String) The resource bundle file name, in dotted
notation. Example:
new MessageBundle("package.SomeMessageFile");
public MessageBundle(java.util.ResourceBundle bundle)
MessageBundle
for the specified
resource bundle.bundle
- (ResourceBundle) The resource bundle object.public java.lang.String getMessage(java.lang.String msgid)
msgid
- (String) The resource key for the message to retrieve.public java.lang.String getMessage(java.lang.String msgid, java.lang.String... values)
msgid
- (String) The resource key for the message to retrieve.values
- (String) The value(s) that are to be substituted into
the message text. This parameter uses the varargs feature and
can therefore be passed as multiple parms (msgid, value1, value2,
value3, valueN) or as an array (msgid, values[]).private java.lang.String getString(java.lang.String key)
key
- (String) The resource key to retrieve.