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:
  • Constructor Details

    • 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 of FCMessage(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. Use Localizer 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. Use Localizer to retrieve i18n strings for the given locale.
    • FCMessage

      public FCMessage(FCMessage.ESeverity severity, String i18nTitle, String i18nMessage, FCMessage.ParamsLocalizer params)
      Use this instead of FCMessage(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. Use Localizer to retrieve i18n strings for the given locale.
  • Method Details

    • 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()
      Prefer getParams(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.