public class MessageSourceResourceBundle extends ResourceBundle
MessageSource as a ResourceBundle.
Used for example to expose a Spring MessageSource to JSTL web views.MessageSource,
ResourceBundle,
org.springframework.web.servlet.support.JstlUtils#exposeLocalizationContextResourceBundle.Controlparent| 构造器和说明 |
|---|
MessageSourceResourceBundle(MessageSource source,
Locale locale)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.
|
MessageSourceResourceBundle(MessageSource source,
Locale locale,
ResourceBundle parent)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
containsKey(String key)
This implementation checks whether the target MessageSource can resolve
a message for the given key, translating
NoSuchMessageException
accordingly. |
Enumeration<String> |
getKeys()
This implementation throws
UnsupportedOperationException,
as a MessageSource does not allow for enumerating the defined message codes. |
Locale |
getLocale()
This implementation exposes the specified Locale for introspection
through the standard
ResourceBundle.getLocale() method. |
protected Object |
handleGetObject(String key)
This implementation resolves the code in the MessageSource.
|
clearCache, clearCache, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleKeySet, keySet, setParentpublic MessageSourceResourceBundle(MessageSource source, Locale locale)
source - the MessageSource to retrieve messages fromlocale - the Locale to retrieve messages forpublic MessageSourceResourceBundle(MessageSource source, Locale locale, ResourceBundle parent)
source - the MessageSource to retrieve messages fromlocale - the Locale to retrieve messages forparent - the parent ResourceBundle to delegate to if no local message found@Nullable protected Object handleGetObject(String key)
null if the message could not be resolved.handleGetObject 在类中 ResourceBundlepublic boolean containsKey(String key)
NoSuchMessageException
accordingly. In contrast to ResourceBundle's default implementation in
JDK 1.6, this does not rely on the capability to enumerate message keys.containsKey 在类中 ResourceBundlepublic Enumeration<String> getKeys()
UnsupportedOperationException,
as a MessageSource does not allow for enumerating the defined message codes.getKeys 在类中 ResourceBundlepublic Locale getLocale()
ResourceBundle.getLocale() method.getLocale 在类中 ResourceBundle