Package io.jmix.core

Interface Messages

All Known Implementing Classes:
MessagesImpl

public interface Messages
Central interface to work with localized messages.
  • Method Details

    • getMessage

      String getMessage(String key)
      Returns localized message.
      Locale is determined by the current user session.
      Parameters:
      key - message key
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(String key, Locale locale)
      Returns localized message.
      Parameters:
      key - message key
      locale - message locale
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(Class caller, String key)
      Returns localized message.
      Locale is determined by the current user session.
      Parameters:
      caller - determines the message group as class' package name
      key - message key
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(Class caller, String key, Locale locale)
      Returns localized message.
      Parameters:
      caller - determines the message group as class' package name
      key - message key
      locale - message locale
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(Enum caller)
      Returns localized message.
      Locale is determined by the current user session.
      Parameters:
      caller - enum determining the message group and key:
      • group - enum's package name
      • key - enum's short class name (after last dot), plus dot, plus enum value
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(Enum caller, Locale locale)
      Returns localized message.
      Parameters:
      caller - enum determining the message group and key:
      • group - enum's package name
      • key - enum's short class name (after last dot), plus dot, plus enum value
      locale - message locale
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(String group, String key)
      Returns localized message. Locale is determined by the current user session.
      Parameters:
      group - message group
      key - message key
      Returns:
      localized message or the key if the message not found
    • getMessage

      String getMessage(String group, String key, Locale locale)
      Returns localized message.
      Parameters:
      group - message group
      key - message key
      locale - message locale
      Returns:
      localized message or the key if the message not found
    • formatMessage

      String formatMessage(Class caller, String key, Object... params)
      Get localized message and use it as a format string for parameters provided.
      Locale is determined by the current user session.
      Parameters:
      caller - determines the message group as class' package name
      key - message key
      params - parameter values
      Returns:
      formatted string or the key in case of IllegalFormatException
    • formatMessage

      String formatMessage(Class caller, String key, Locale locale, Object... params)
      Get localized message and use it as a format string for parameters provided
      Parameters:
      caller - determines the message group as class' package name
      key - message key
      locale - message locale
      params - parameter values
      Returns:
      formatted string or the key in case of IllegalFormatException
    • formatMessage

      String formatMessage(String group, String key, Object... params)
      Get localized message and use it as a format string for parameters provided.
      Locale is determined by the current user session.
      Parameters:
      group - message group
      key - message key
      params - parameter values
      Returns:
      formatted string or the key in case of IllegalFormatException
    • formatMessage

      String formatMessage(String group, String key, Locale locale, Object... params)
      Get localized message and use it as a format string for parameters provided
      Parameters:
      group - message group
      key - message key
      locale - message locale
      params - parameter values
      Returns:
      formatted string or the key in case of IllegalFormatException
    • findMessage

      @Nullable String findMessage(String key, @Nullable Locale locale)
      Returns localized message or null if not found.
      Parameters:
      key - message key
      locale - message locale. If null, current user locale is used.
      Returns:
      localized message or null if the message not found
    • findMessage

      @Nullable String findMessage(String group, String key, @Nullable Locale locale)
      Returns localized message or null if not found.
      Parameters:
      group - message group
      key - message key
      locale - message locale. If null, current user locale is used.
      Returns:
      localized message or null if the message not found
    • clearCache

      void clearCache()