Package dev.orne.i18n.context
Class DummyI18nResources
java.lang.Object
dev.orne.i18n.context.DummyI18nResources
- All Implemented Interfaces:
I18nResources
@API(status=STABLE,
since="0.1")
public class DummyI18nResources
extends Object
implements I18nResources
Dummy implementation of
I18nResources
that always returns the
defaultMessage
, formated with passed arguments.- Since:
- 0.1
- Version:
- 1.0, 2021-01
- Author:
- (w) Iker Hernaez
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull DummyI18nResources
Returns the shared instance.@NotNull String
getMessage
(@NotNull String defaultMessage, String[] codes, Object... params) Retrieves the I18N message for the specified locale of the first message code efined in this I18N resources of specified message codes.@NotNull String
getMessage
(@NotNull String defaultMessage, String[] codes, Locale locale, Object... params) Retrieves the I18N message for the specified locale of the first message code efined in this I18N resources of specified message codes.@NotNull String
getMessage
(@NotNull String defaultMessage, String code, Object... params) Retrieves the I18N message for the specified message code and the 18N context locale.@NotNull String
getMessage
(@NotNull String defaultMessage, String code, Locale locale, Object... params) Retrieves the I18N message for the specified message code and locale.
-
Method Details
-
getInstance
Returns the shared instance.- Returns:
- The shared instance.
-
getMessage
@NotNull public @NotNull String getMessage(@NotNull @NotNull String defaultMessage, String code, Object... params) Retrieves the I18N message for the specified message code and the 18N context locale. If the message code is not defined in this I18N resources the specified default message is used. The message is formatted with the provided parameters.- Specified by:
getMessage
in interfaceI18nResources
- Parameters:
defaultMessage
- The default message formatcode
- The message codeparams
- The message parameters- Returns:
- The formatted message in the I18N context locale
-
getMessage
@NotNull public @NotNull String getMessage(@NotNull @NotNull String defaultMessage, String code, Locale locale, Object... params) Retrieves the I18N message for the specified message code and locale. If the message code is not defined in this I18N resources the specified default message is used. The message is formatted with the provided parameters.- Specified by:
getMessage
in interfaceI18nResources
- Parameters:
defaultMessage
- The default message formatcode
- The message codelocale
- The locale to retrieve the message forparams
- The message parameters- Returns:
- The formatted message in the specified locale
-
getMessage
@NotNull public @NotNull String getMessage(@NotNull @NotNull String defaultMessage, String[] codes, Object... params) Retrieves the I18N message for the specified locale of the first message code efined in this I18N resources of specified message codes. If no message code is defined in this I18N resources the specified default message is used. The message is formatted with the provided parameters.- Specified by:
getMessage
in interfaceI18nResources
- Parameters:
defaultMessage
- The default message formatcodes
- The message codes, in order of preferenceparams
- The message parameters- Returns:
- The formatted message in the I18N context locale
-
getMessage
@NotNull public @NotNull String getMessage(@NotNull @NotNull String defaultMessage, String[] codes, Locale locale, Object... params) Retrieves the I18N message for the specified locale of the first message code efined in this I18N resources of specified message codes. If no message code is defined in this I18N resources the specified default message is used. The message is formatted with the provided parameters.- Specified by:
getMessage
in interfaceI18nResources
- Parameters:
defaultMessage
- The default message formatcodes
- The message codes, in order of preferencelocale
- The locale to retrieve the message forparams
- The message parameters- Returns:
- The formatted message in the specified locale
-