Package io.jmix.core.impl
Class MessagesImpl
java.lang.Object
io.jmix.core.impl.MessagesImpl
- All Implemented Interfaces:
Messages
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentAuthentication
protected org.springframework.context.MessageSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected String
fallbackMessageOrKey
(String group, String key, Locale locale) protected String
fallbackMessageOrNull
(String group, String key, Locale locale) findMessage
(String group, String key, Locale locale) Returns localized message or null if not found.findMessage
(String key, Locale locale) Returns localized message or null if not found.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.formatMessage
(Class caller, String key, Locale locale, Object... params) Get localized message and use it as a format string for parameters providedformatMessage
(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.formatMessage
(String group, String key, Locale locale, Object... params) Get localized message and use it as a format string for parameters providedprotected String
protected Locale
protected String
getMessage
(Class caller, String key) Returns localized message.
Locale is determined by the current user session.getMessage
(Class caller, String key, Locale locale) Returns localized message.getMessage
(Enum caller) Returns localized message.
Locale is determined by the current user session.getMessage
(Enum caller, Locale locale) Returns localized message.getMessage
(String key) Returns localized message.
Locale is determined by the current user session.getMessage
(String group, String key) Returns localized message.getMessage
(String group, String key, Locale locale) Returns localized message.getMessage
(String key, Locale locale) Returns localized message.protected Locale
-
Field Details
-
messageSource
@Autowired protected org.springframework.context.MessageSource messageSource -
currentAuthentication
-
-
Constructor Details
-
MessagesImpl
public MessagesImpl()
-
-
Method Details
-
getMessage
Description copied from interface:Messages
Returns localized message.
Locale is determined by the current user session.- Specified by:
getMessage
in interfaceMessages
- Parameters:
key
- message key- Returns:
- localized message or the key if the message not found
-
getMessage
Description copied from interface:Messages
Returns localized message.- Specified by:
getMessage
in interfaceMessages
- Parameters:
key
- message keylocale
- message locale- Returns:
- localized message or the key if the message not found
-
getMessage
Description copied from interface:Messages
Returns localized message.
Locale is determined by the current user session.- Specified by:
getMessage
in interfaceMessages
- Parameters:
caller
- determines the message group as class' package namekey
- message key- Returns:
- localized message or the key if the message not found
-
getMessage
Description copied from interface:Messages
Returns localized message.- Specified by:
getMessage
in interfaceMessages
- Parameters:
caller
- determines the message group as class' package namekey
- message keylocale
- message locale- Returns:
- localized message or the key if the message not found
-
getMessage
Description copied from interface:Messages
Returns localized message.
Locale is determined by the current user session.- Specified by:
getMessage
in interfaceMessages
- 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
Description copied from interface:Messages
Returns localized message.- Specified by:
getMessage
in interfaceMessages
- 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
Description copied from interface:Messages
Returns localized message. Locale is determined by the current user session.- Specified by:
getMessage
in interfaceMessages
- Parameters:
group
- message groupkey
- message key- Returns:
- localized message or the key if the message not found
-
getMessage
Description copied from interface:Messages
Returns localized message.- Specified by:
getMessage
in interfaceMessages
- Parameters:
group
- message groupkey
- message keylocale
- message locale- Returns:
- localized message or the key if the message not found
-
formatMessage
Description copied from interface:Messages
Get localized message and use it as a format string for parameters provided.
Locale is determined by the current user session.- Specified by:
formatMessage
in interfaceMessages
- Parameters:
caller
- determines the message group as class' package namekey
- message keyparams
- parameter values- Returns:
- formatted string or the key in case of IllegalFormatException
-
formatMessage
Description copied from interface:Messages
Get localized message and use it as a format string for parameters provided- Specified by:
formatMessage
in interfaceMessages
- Parameters:
caller
- determines the message group as class' package namekey
- message keylocale
- message localeparams
- parameter values- Returns:
- formatted string or the key in case of IllegalFormatException
-
formatMessage
Description copied from interface:Messages
Get localized message and use it as a format string for parameters provided.
Locale is determined by the current user session.- Specified by:
formatMessage
in interfaceMessages
- Parameters:
group
- message groupkey
- message keyparams
- parameter values- Returns:
- formatted string or the key in case of IllegalFormatException
-
formatMessage
Description copied from interface:Messages
Get localized message and use it as a format string for parameters provided- Specified by:
formatMessage
in interfaceMessages
- Parameters:
group
- message groupkey
- message keylocale
- message localeparams
- parameter values- Returns:
- formatted string or the key in case of IllegalFormatException
-
findMessage
Description copied from interface:Messages
Returns localized message or null if not found.- Specified by:
findMessage
in interfaceMessages
- Parameters:
key
- message keylocale
- message locale. If null, current user locale is used.- Returns:
- localized message or null if the message not found
-
findMessage
Description copied from interface:Messages
Returns localized message or null if not found.- Specified by:
findMessage
in interfaceMessages
- Parameters:
group
- message groupkey
- message keylocale
- message locale. If null, current user locale is used.- Returns:
- localized message or null if the message not found
-
clearCache
public void clearCache()- Specified by:
clearCache
in interfaceMessages
-
getCode
-
getUserLocale
-
getDefaultLocale
-
getGroup
-
fallbackMessageOrKey
-
fallbackMessageOrNull
-