public class ResourceBundleMessageSource extends AbstractMessageSource
AbstractMessageSource.MessageKey
MessageSource.MessageContext
EMPTY
Constructor and Description |
---|
ResourceBundleMessageSource(java.lang.String baseName)
Default constructor.
|
ResourceBundleMessageSource(java.lang.String baseName,
java.util.Locale defaultLocale)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<AbstractMessageSource.MessageKey,java.util.Optional<java.util.ResourceBundle>> |
buildBundleCache()
Build the cache used to store resolved bundles.
|
protected java.util.Map<AbstractMessageSource.MessageKey,java.util.Optional<java.lang.String>> |
buildMessageCache()
Build the cache used to store resolved messages.
|
protected java.lang.ClassLoader |
getClassLoader()
The class loader to use.
|
java.util.Optional<java.lang.String> |
getRawMessage(java.lang.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, getRawMessage, getRequiredMessage, getRequiredRawMessage
public ResourceBundleMessageSource(@NonNull java.lang.String baseName)
baseName
- The base name of the message bundlepublic ResourceBundleMessageSource(@NonNull java.lang.String baseName, @Nullable java.util.Locale defaultLocale)
baseName
- The base name of the message bundledefaultLocale
- The default locale to use if no message is found for the given locale@NonNull public java.util.Optional<java.lang.String> getRawMessage(@NonNull java.lang.String code, @NonNull MessageSource.MessageContext context)
MessageSource
code
- The codecontext
- The contextprotected java.lang.ClassLoader getClassLoader()
@NonNull protected java.util.Map<AbstractMessageSource.MessageKey,java.util.Optional<java.lang.String>> buildMessageCache()
@NonNull protected java.util.Map<AbstractMessageSource.MessageKey,java.util.Optional<java.util.ResourceBundle>> buildBundleCache()