|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.support.MessageSourceAccessor
Helper class for easy access to messages from a MessageSource, providing various overloaded getMessage methods.
Available from ApplicationObjectSupport, but also reusable as a standalone helper to delegate to in application objects.
ApplicationObjectSupport.getMessageSourceAccessor()
Constructor Summary | |
MessageSourceAccessor(MessageSource messageSource)
Create a new MessageSourceAccessor, using the system Locale as default Locale. |
|
MessageSourceAccessor(MessageSource messageSource,
java.util.Locale defaultLocale)
Create a new MessageSourceAccessor, using the given default locale. |
Method Summary | |
java.lang.String |
getMessage(MessageSourceResolvable resolvable)
Retrieve the given MessageSourceResolvable (e.g. |
java.lang.String |
getMessage(MessageSourceResolvable resolvable,
java.util.Locale locale)
Retrieve the given MessageSourceResolvable (e.g. |
java.lang.String |
getMessage(java.lang.String code)
Retrieve the message for the given code and the default Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.util.Locale locale)
Retrieve the message for the given code and the given Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args)
Retrieve the message for the given code and the default Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
Retrieve the message for the given code and the given Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage)
Retrieve the message for the given code and the default Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
Retrieve the message for the given code and the given Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.String defaultMessage)
Retrieve the message for the given code and the default Locale. |
java.lang.String |
getMessage(java.lang.String code,
java.lang.String defaultMessage,
java.util.Locale locale)
Retrieve the message for the given code and the given Locale. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MessageSourceAccessor(MessageSource messageSource)
messageSource
- the MessageSource to wrappublic MessageSourceAccessor(MessageSource messageSource, java.util.Locale defaultLocale)
messageSource
- the MessageSource to wrapdefaultLocale
- the default locale to use for message accessMethod Detail |
public java.lang.String getMessage(java.lang.String code, java.lang.String defaultMessage)
code
- code of the messagedefaultMessage
- String to return if the lookup fails
public java.lang.String getMessage(java.lang.String code, java.lang.String defaultMessage, java.util.Locale locale)
code
- code of the messagedefaultMessage
- String to return if the lookup failslocale
- Locale in which to do lookup
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage)
code
- code of the messageargs
- arguments for the message, or null if nonedefaultMessage
- String to return if the lookup fails
public java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)
code
- code of the messageargs
- arguments for the message, or null if nonedefaultMessage
- String to return if the lookup failslocale
- Locale in which to do lookup
public java.lang.String getMessage(java.lang.String code) throws NoSuchMessageException
code
- code of the message
NoSuchMessageException
- if not foundpublic java.lang.String getMessage(java.lang.String code, java.util.Locale locale) throws NoSuchMessageException
code
- code of the messagelocale
- Locale in which to do lookup
NoSuchMessageException
- if not foundpublic java.lang.String getMessage(java.lang.String code, java.lang.Object[] args) throws NoSuchMessageException
code
- code of the messageargs
- arguments for the message, or null if none
NoSuchMessageException
- if not foundpublic java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws NoSuchMessageException
code
- code of the messageargs
- arguments for the message, or null if nonelocale
- Locale in which to do lookup
NoSuchMessageException
- if not foundpublic java.lang.String getMessage(MessageSourceResolvable resolvable) throws NoSuchMessageException
resolvable
- the MessageSourceResolvable
NoSuchMessageException
- if not foundpublic java.lang.String getMessage(MessageSourceResolvable resolvable, java.util.Locale locale) throws NoSuchMessageException
resolvable
- the MessageSourceResolvablelocale
- Locale in which to do lookup
NoSuchMessageException
- if not found
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |