public class LocalizableMessageFactory
extends java.lang.Object
LocalizableMessage
instances.
Message data (keys, templates) are loaded from ResourceBundle
.
Constructor and Description |
---|
LocalizableMessageFactory(java.util.ResourceBundle msgBundle,
TemplateFormatter formatter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
LocalizableMessage |
getLocalizableMessage(java.lang.String msgId,
java.lang.Object... args)
Creates a
LocalizableMessage for the specified ID and
typed arguments. |
LocalizableMessage |
getLocalizableMessage(java.lang.String msgId,
java.lang.String... args)
Creates a
LocalizableMessage for the specified ID and
arguments. |
public LocalizableMessageFactory(java.util.ResourceBundle msgBundle, TemplateFormatter formatter)
msgBundle
- resource bundle for messages; can not be
null
formatter
- message template formatter to be used for default
message generation for the created
LocalizableMessage
s; may be nullpublic LocalizableMessage getLocalizableMessage(java.lang.String msgId, java.lang.String... args)
LocalizableMessage
for the specified ID and
arguments.
In case message template can not be found for the specified
msgId
a default 'unknown' message is returned.
If TemplateFormatter
is set for this factory
LocalizableMessage.getDefaultMessage()
will be set to
localized string for the locale of the ResourceBundle
for
this factory. Otherwise default message will be the raw message template.
msgId
- identifier for the messageargs
- arguments to substitute in the message templateLocalizableMessage
isntancepublic LocalizableMessage getLocalizableMessage(java.lang.String msgId, java.lang.Object... args)
LocalizableMessage
for the specified ID and
typed arguments.
Supported types are
java.lang.Long
java.lang.Double
java.lang.String
java.util.Calendar
LocalizationException
- if argument of unsupported type is
presentedgetLocalizableMessage(String, String...)