public class ResourceBundleMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKeyMessageSource.MessageContextEMPTY| Constructor and Description |
|---|
ResourceBundleMessageSource(String baseName)
Default constructor.
|
ResourceBundleMessageSource(String baseName,
Locale defaultLocale)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Map<AbstractMessageSource.MessageKey,Optional<ResourceBundle>> |
buildBundleCache()
Build the cache used to store resolved bundles.
|
protected Map<AbstractMessageSource.MessageKey,Optional<String>> |
buildMessageCache()
Build the cache used to store resolved messages.
|
protected ClassLoader |
getClassLoader()
The class loader to use.
|
Optional<String> |
getMessage(String code,
MessageSource.MessageContext context)
Resolve a message for the given code and context.
|
interpolateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMessage, getRequiredMessagepublic ResourceBundleMessageSource(@Nonnull String baseName)
baseName - The base name of the message bundle@Nonnull public Optional<String> getMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context)
MessageSourcecode - The codecontext - The contextprotected ClassLoader getClassLoader()
@Nonnull protected Map<AbstractMessageSource.MessageKey,Optional<String>> buildMessageCache()
@Nonnull protected Map<AbstractMessageSource.MessageKey,Optional<ResourceBundle>> buildBundleCache()