Package de.xima.fc.mdl
Class FCMessage
- java.lang.Object
-
- de.xima.fc.mdl.FCMessage
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FCMessage
public class FCMessage extends Object implements Serializable
A message that may be shown to the user. This message only stores the I18N keys for the localized strings, it does not know about the current locale. The current locale is only known for the current view or session, so this is used in the backend to avoid creating a dependency on the UI.- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FCMessage.ESeverity
static interface
FCMessage.ParamsLocalizer
-
Constructor Summary
Constructors Constructor Description FCMessage(FCMessage.ESeverity severity, String i18nMessage, FCMessage.ParamsLocalizer params)
Use this instead ofFCMessage(ESeverity, String, Serializable...)
in case the parameters depend on the locale as well.FCMessage(FCMessage.ESeverity severity, String i18nMessage, Serializable... params)
FCMessage(FCMessage.ESeverity severity, String i18nTitle, String i18nMessage, FCMessage.ParamsLocalizer params)
Use this instead ofFCMessage(ESeverity, String, String, Serializable...)
in case the parameters depend on the locale as well.FCMessage(FCMessage.ESeverity severity, String i18nTitle, String i18nMessage, Serializable... params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getI18nMessage()
String
getI18nTitle()
Serializable[]
getParams()
PrefergetParams(Locale)
if the locale is known.Serializable[]
getParams(Locale locale)
The parameters of the message may depend on the locale as well.FCMessage.ESeverity
getSeverity()
-
-
-
Constructor Detail
-
FCMessage
public FCMessage(FCMessage.ESeverity severity, String i18nMessage, Serializable... params)
- Parameters:
severity
- The severity of this message.i18nMessage
- i18n key of the message details to be shown.params
- Optional parameters for the message. Occurrences of{0}
,{1}
in the message are replaced with these parameters.
-
FCMessage
public FCMessage(FCMessage.ESeverity severity, String i18nMessage, FCMessage.ParamsLocalizer params)
Use this instead ofFCMessage(ESeverity, String, Serializable...)
in case the parameters depend on the locale as well. This constructor creates a message with no title (summary).- Parameters:
severity
- The severity of this message.i18nMessage
- i18n key of the message details to be shown.params
- Function that receives the desired locale and returns the localized parameters. UseLocalizer
to retrieve i18n strings for the given locale.
-
FCMessage
public FCMessage(FCMessage.ESeverity severity, String i18nTitle, String i18nMessage, Serializable... params)
- Parameters:
severity
- The severity of this message.i18nTitle
- i18n key of the message summary to be shown.i18nMessage
- i18n key of the message details to be shown.params
- Function that receives the desired locale and returns the localized parameters. UseLocalizer
to retrieve i18n strings for the given locale.
-
FCMessage
public FCMessage(FCMessage.ESeverity severity, String i18nTitle, String i18nMessage, FCMessage.ParamsLocalizer params)
Use this instead ofFCMessage(ESeverity, String, String, Serializable...)
in case the parameters depend on the locale as well.- Parameters:
severity
- The severity of this message.i18nTitle
- i18n key of the message summary to be shown.i18nMessage
- i18n key of the message details to be shown.params
- Function that receives the desired locale and returns the localized parameters. UseLocalizer
to retrieve i18n strings for the given locale.
-
-
Method Detail
-
getI18nTitle
public String getI18nTitle()
- Returns:
- i18n key of the message summary to be shown.
-
getI18nMessage
public String getI18nMessage()
- Returns:
- i18n key of the message details to be shown.
-
getParams
public Serializable[] getParams(Locale locale)
The parameters of the message may depend on the locale as well.- Parameters:
locale
- The desired locale.- Returns:
- The optional parameters for this message, for the given locale.
-
getParams
public Serializable[] getParams()
PrefergetParams(Locale)
if the locale is known.- Returns:
- The optional parameters for this message, for the given locale.
-
getSeverity
public FCMessage.ESeverity getSeverity()
- Returns:
- The severity of this message, eg. error, warning etc.
-
-