|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.digi.config.util.LocalizableMessage
Helper class to encapsulate the retrieval and formatting of localizable messages. Instances of this class should be considered immutable. In support of this, copies are made of the substitution objects provided on the construction of instances of this class.
| Constructor Summary | |
LocalizableMessage(java.lang.String rsrcBundleName,
java.lang.String key,
java.io.Serializable[] rplcTxt,
java.util.Locale originalLocale)
Create a localizable message object. |
|
| Method Summary | |
java.lang.String |
getFallbackMessage()
Gets the message text that will be returned in localization of this message fails. |
java.lang.String |
getLocalizedText(java.util.Locale localeToUse)
Returns the localized text for this message. |
java.util.Locale |
getOriginalLocale()
Gets the original locale used to create this message. |
java.rmi.MarshalledObject[] |
getReplacementText()
Gets the replacement text that is used to create the localizable message text. |
java.lang.String |
getResourceBundleName()
Gets the name of the resource bundle from where the resource used to create the localizable message text will be retrieved. |
java.lang.String |
getResourceKey()
Gets the key to the resource in the resourceBundle that is used to create the localizable message text. |
protected java.lang.String |
localize(java.lang.String rsrcBundleName,
java.lang.String key,
java.io.Serializable[] rplcText,
java.util.Locale localeToUse)
Returns the localized text for this message. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LocalizableMessage(java.lang.String rsrcBundleName,
java.lang.String key,
java.io.Serializable[] rplcTxt,
java.util.Locale originalLocale)
rsrcBundleName - is the name of the resource bundle containing the translatable
message text. This must be a fully qualified name
(e.g. com.key - is the key into the resourceBundle of the message text to use
for this localizable message. The resource associated with this key must either
be a String or a MessageFormat. It is a
Mandatory parameter and may not be an empty String.rplcTxt - is the array of objects to be used as replacement
text in the text retrieved from the resourceBundle. An array element may not
be nulloriginalLocale - is the Locale to be considered as the Locale of the message origin.
It is primarily used for creating the fallbackMsg. If left null, the default
Locale of the system will be used.
java.lang.IllegalArgumentException - if rsrcBundleName or key is empty string. It may also be thrown
if an unexpected error is detected while processing the replacement text.
java.lang.NullPointerException - if rsrcrBundleName or key is null or replacementText array contains a
null.| Method Detail |
public java.lang.String getLocalizedText(java.util.Locale localeToUse)
localeToUse - is the Locale to be used for localizing the text. If not provided,
the default system Locale will be used.
public java.util.Locale getOriginalLocale()
public java.lang.String getResourceKey()
public java.rmi.MarshalledObject[] getReplacementText()
public java.lang.String getResourceBundleName()
public java.lang.String getFallbackMessage()
public java.lang.String toString()
protected java.lang.String localize(java.lang.String rsrcBundleName,
java.lang.String key,
java.io.Serializable[] rplcText,
java.util.Locale localeToUse)
throws LocalizationException
rsrcBundleName - is the name of the resource bundle containing the translatable
message text. This must be a fully qualified name
(e.g. com.key - is the key into the resourceBundle of the message text to use
for this localizable message. The key must be associated with either a String or
a MessageFormat object. It is a Mandatory parameter and may not be an empty String.rplcText - is the array of objects to be used as replacement
text in the text retrieved from the resourceBundle.localeToUse - is the Locale in which the message text is to be formatted. It
is a Mandatory parameter.
LocalizationException - is thrown if localization fails. This may be because the retrieval of the
resource from the messageBundle failed, the retrieved resource was not a String or
MessageFormat object.
java.util.MissingResourceException - is thrown if either the resourceBundle is not found
or the key is not valid within the resourceBundle
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||