@Singleton @Indexed(value=MessageSource.class) public interface MessageSource
| Modifier and Type | Interface and Description | 
|---|---|
| static interface  | MessageSource.MessageContextThe context to use. | 
| Modifier and Type | Field and Description | 
|---|---|
| static MessageSource | EMPTYAn empty message source. | 
| Modifier and Type | Method and Description | 
|---|---|
| Optional<String> | getMessage(String code,
          MessageSource.MessageContext context)Resolve a message for the given code and context. | 
| default String | getMessage(String code,
          MessageSource.MessageContext context,
          String defaultMessage)Resolve a message for the given code and context. | 
| default String | getRequiredMessage(String code,
                  MessageSource.MessageContext context)Resolve a message for the given code and context or throw an exception. | 
| String | interpolate(String template,
           MessageSource.MessageContext context)Interpolate the given message template. | 
static final MessageSource EMPTY
@Nonnull Optional<String> getMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context)
code - The codecontext - The context@Nonnull default String getMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context, @Nonnull String defaultMessage)
code - The codecontext - The contextdefaultMessage - The default message to use if no other message is found@Nonnull String interpolate(@Nonnull String template, @Nonnull MessageSource.MessageContext context)
template - The templatecontext - The context to use.IllegalArgumentException - If any argument specified is null@Nonnull default String getRequiredMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context)
code - The codecontext - The contextNoSuchMessageException - if the message is not found