Class MessageSourceResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- com.aspectran.core.support.i18n.message.MessageSourceResourceBundle
-
public class MessageSourceResourceBundle extends java.util.ResourceBundle
This class is a clone of org.springframework.context.support.MessageSourceResourceBundle
Helper class that allows for accessing an AspectranMessageSource
as aResourceBundle
.- See Also:
ResourceBundle
-
-
Constructor Summary
Constructors Constructor Description MessageSourceResourceBundle(MessageSource source, java.util.Locale locale)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.MessageSourceResourceBundle(MessageSource source, java.util.Locale locale, java.util.ResourceBundle parent)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(java.lang.String key)
This implementation checks whether the target MessageSource can resolve a message for the given key, translatingNoSuchMessageException
accordingly.java.util.Enumeration<java.lang.String>
getKeys()
This implementation throwsUnsupportedOperationException
, as a MessageSource does not allow for enumerating the defined message codes.java.util.Locale
getLocale()
This implementation exposes the specified Locale for introspection through the standardResourceBundle.getLocale()
method.protected java.lang.Object
handleGetObject(java.lang.String key)
This implementation resolves the code in the MessageSource.
-
-
-
Constructor Detail
-
MessageSourceResourceBundle
public MessageSourceResourceBundle(MessageSource source, java.util.Locale locale)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.- Parameters:
source
- the MessageSource to retrieve messages fromlocale
- the Locale to retrieve messages for
-
MessageSourceResourceBundle
public MessageSourceResourceBundle(MessageSource source, java.util.Locale locale, java.util.ResourceBundle parent)
Create a new MessageSourceResourceBundle for the given MessageSource and Locale.- Parameters:
source
- the MessageSource to retrieve messages fromlocale
- the Locale to retrieve messages forparent
- the parent ResourceBundle to delegate to if no local message found
-
-
Method Detail
-
handleGetObject
protected java.lang.Object handleGetObject(java.lang.String key)
This implementation resolves the code in the MessageSource. Returnsnull
if the message could not be resolved.- Specified by:
handleGetObject
in classjava.util.ResourceBundle
-
containsKey
public boolean containsKey(java.lang.String key)
This implementation checks whether the target MessageSource can resolve a message for the given key, translatingNoSuchMessageException
accordingly. In contrast to ResourceBundle's default implementation in JDK 1.6, this does not rely on the capability to enumerate message keys.- Overrides:
containsKey
in classjava.util.ResourceBundle
-
getKeys
public java.util.Enumeration<java.lang.String> getKeys()
This implementation throwsUnsupportedOperationException
, as a MessageSource does not allow for enumerating the defined message codes.- Specified by:
getKeys
in classjava.util.ResourceBundle
-
getLocale
public java.util.Locale getLocale()
This implementation exposes the specified Locale for introspection through the standardResourceBundle.getLocale()
method.- Overrides:
getLocale
in classjava.util.ResourceBundle
-
-