T
- The context object which will be used to resolve the localepublic abstract class AbstractLocalizedMessageSource<T> extends Object implements LocalizedMessageSource
LocalizedMessageSource
and leverages LocaleResolver
API.Constructor and Description |
---|
AbstractLocalizedMessageSource(LocaleResolver<T> localeResolver,
MessageSource messageSource) |
Modifier and Type | Method and Description |
---|---|
protected abstract Locale |
getLocale() |
Optional<String> |
getMessage(String code)
Resolve a message for the given code.
|
Optional<String> |
getMessage(String code,
Map<String,Object> variables)
Resolve a message for the given code and variables for the messages.
|
Optional<String> |
getMessage(String code,
Object... variables)
Resolve a message for the given code and variables for the messages.
|
protected Locale |
resolveLocale(T localeResolutionContext) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageOrDefault, getMessageOrDefault, getMessageOrDefault
public AbstractLocalizedMessageSource(LocaleResolver<T> localeResolver, MessageSource messageSource)
localeResolver
- The locale resolvermessageSource
- The message source@NonNull public Optional<String> getMessage(@NonNull String code, Object... variables)
getMessage
in interface LocalizedMessageSource
code
- The codevariables
- to be used to interpolate the message@NonNull public Optional<String> getMessage(@NonNull String code, Map<String,Object> variables)
getMessage
in interface LocalizedMessageSource
code
- The codevariables
- to be used to interpolate the message@NonNull public Optional<String> getMessage(@NonNull String code)
LocalizedMessageSource
getMessage
in interface LocalizedMessageSource
code
- The code