public class ResourceBundleMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKey
MessageSource.MessageContext
EMPTY
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.
|
interpolate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessage, getRequiredMessage
public ResourceBundleMessageSource(@Nonnull String baseName)
baseName
- The base name of the message bundle@Nonnull public Optional<String> getMessage(@Nonnull String code, @Nonnull MessageSource.MessageContext context)
MessageSource
code
- The codecontext
- The contextprotected ClassLoader getClassLoader()
@Nonnull protected Map<AbstractMessageSource.MessageKey,Optional<String>> buildMessageCache()
@Nonnull protected Map<AbstractMessageSource.MessageKey,Optional<ResourceBundle>> buildBundleCache()