public class StaticMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKey
MessageSource.MessageContext
EMPTY
Constructor and Description |
---|
StaticMessageSource() |
Modifier and Type | Method and Description |
---|---|
StaticMessageSource |
addMessage(Locale locale,
String code,
String message)
Adds a message to the default locale.
|
StaticMessageSource |
addMessage(String code,
String message)
Adds a message to the default locale.
|
Optional<String> |
getMessage(String code,
MessageSource.MessageContext context)
Resolve a message for the given code and context.
|
interpolate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessage, getRequiredMessage
@Nonnull public StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message)
code
- The codemessage
- The message@Nonnull public StaticMessageSource addMessage(@Nonnull Locale locale, @Nonnull String code, @Nonnull String message)
locale
- The localecode
- The codemessage
- The message@Nonnull public Optional<String> getMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context)
MessageSource
code
- The codecontext
- The context