public class ResourceBundleMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKey
MessageSource.MessageContext
EMPTY
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
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> |
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
public ResourceBundleMessageSource(@NonNull String baseName)
baseName
- The base name of the message bundle@NonNull public Optional<String> getRawMessage(@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()