public interface I18nAware extends Serializable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
I18nAware.I18nSource |
| Modifier and Type | Method and Description |
|---|---|
default void |
applyLocale(Locale locale,
@NotNull I18nAware.I18nSource source)
apply the internal locale and updates the i18n state based on the provided source.
|
@Nullable Object[] |
getI18nArgs()
the args of template
|
default Object[] |
getI18nArgsIf(boolean nonnull) |
default Object[] |
getI18nArgsOr(Object... elze) |
@Nullable String |
getI18nCode()
the i18n code, also template id
|
default String |
getI18nCodeIf(boolean nonnull) |
default String |
getI18nCodeOr(String elze) |
@Nullable String |
getI18nHint()
the default message or template (if no template by code)
|
default String |
getI18nHintIf(boolean nonnull) |
default String |
getI18nHintOr(String elze) |
default @NotNull I18nString |
toI18nString() |
default @NotNull I18nString |
toI18nString(String hint)
use getI18nHint() if hint is null
|
default @NotNull I18nString |
toI18nString(String hint,
Object... args)
use getI18nHint() if hint is null, getI18nArgs() if args is null
|
default String |
toString(Locale locale) |
default String |
toString(Locale locale,
@NotNull I18nAware.I18nSource source) |
static String |
toString(Locale locale,
@NotNull I18nAware.I18nSource source,
String code,
String hint,
Object... args)
should use Locale.getDefault() if locale is null.
|
@Nullable @Nullable String getI18nCode()
@Contract(value="true->!null") default String getI18nCodeIf(boolean nonnull)
@Nullable @Nullable String getI18nHint()
@Contract(value="true->!null") default String getI18nHintIf(boolean nonnull)
@Nullable @Nullable Object[] getI18nArgs()
@Contract(value="true->!null") default Object[] getI18nArgsIf(boolean nonnull)
@NotNull default @NotNull I18nString toI18nString()
@NotNull default @NotNull I18nString toI18nString(String hint)
@NotNull default @NotNull I18nString toI18nString(String hint, Object... args)
default String toString(Locale locale, @NotNull @NotNull I18nAware.I18nSource source)
default void applyLocale(Locale locale, @NotNull @NotNull I18nAware.I18nSource source)
locale - the locale to be appliedsource - the i18n source providing the translations@Contract(value="_,_,!null,_,_->!null") static String toString(Locale locale, @NotNull @NotNull I18nAware.I18nSource source, String code, String hint, Object... args)
should use Locale.getDefault() if locale is null. return the hint if code is empty. return the code if format message get empty. recursively evaluate the args if its item is I18nAware
Copyright © 2025. All rights reserved.