spring-framework / org.springframework.context.support / MessageSourceResourceBundle

MessageSourceResourceBundle

open class MessageSourceResourceBundle : ResourceBundle

Helper class that allows for accessing a Spring org.springframework.context.MessageSource as a java.util.ResourceBundle. Used for example to expose a Spring MessageSource to JSTL web views.

Author
Juergen Hoeller

Since
27.02.2003

See Also
org.springframework.context.MessageSourcejava.util.ResourceBundleorg.springframework.web.servlet.support.JstlUtils#exposeLocalizationContext

Constructors

<init>

MessageSourceResourceBundle(source: MessageSource, locale: Locale)
MessageSourceResourceBundle(source: MessageSource, locale: Locale, parent: ResourceBundle)

Create a new MessageSourceResourceBundle for the given MessageSource and Locale.

Functions

containsKey

open fun containsKey(key: String): Boolean

This implementation checks whether the target MessageSource can resolve a message for the given key, translating NoSuchMessageException accordingly. In contrast to ResourceBundle's default implementation in JDK 1.6, this does not rely on the capability to enumerate message keys.

getKeys

open fun getKeys(): Enumeration<String>

This implementation throws UnsupportedOperationException, as a MessageSource does not allow for enumerating the defined message codes.

getLocale

open fun getLocale(): Locale

This implementation exposes the specified Locale for introspection through the standard ResourceBundle.getLocale() method.