public class StaticMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKey
MessageSource.MessageContext
EMPTY
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
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> |
getRawMessage(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, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getRawMessage, getRequiredMessage, getRequiredRawMessage
@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> getRawMessage(@NonNull String code, @NonNull MessageSource.MessageContext context)
MessageSource
code
- The codecontext
- The context