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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new MessageSourceAccessor, using LocaleContextHolder's locale
as default locale.
| |||||||||||
Create a new MessageSourceAccessor, using the given default locale.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieve the message for the given code and the default Locale.
| |||||||||||
Retrieve the message for the given code and the default Locale.
| |||||||||||
Retrieve the message for the given code and the default Locale.
| |||||||||||
Retrieve the message for the given code and the given Locale.
| |||||||||||
Retrieve the message for the given code and the given Locale.
| |||||||||||
Retrieve the message for the given code and the given Locale.
| |||||||||||
Retrieve the given MessageSourceResolvable (e.g.
| |||||||||||
Retrieve the message for the given code and the given Locale.
| |||||||||||
Retrieve the message for the given code and the default Locale.
| |||||||||||
Retrieve the given MessageSourceResolvable (e.g.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return the default locale to use if no explicit locale has been given.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a new MessageSourceAccessor, using LocaleContextHolder's locale as default locale.
messageSource | the MessageSource to wrap |
---|
Create a new MessageSourceAccessor, using the given default locale.
messageSource | the MessageSource to wrap |
---|---|
defaultLocale | the default locale to use for message access |
Retrieve the message for the given code and the default Locale.
code | code of the message |
---|---|
args | arguments for the message, or null if none |
defaultMessage | String to return if the lookup fails |
Retrieve the message for the given code and the default Locale.
code | code of the message |
---|
NoSuchMessageException | if not found |
---|
Retrieve the message for the given code and the default Locale.
code | code of the message |
---|---|
defaultMessage | String to return if the lookup fails |
Retrieve the message for the given code and the given Locale.
code | code of the message |
---|---|
defaultMessage | String to return if the lookup fails |
locale | Locale in which to do lookup |
Retrieve the message for the given code and the given Locale.
code | code of the message |
---|---|
args | arguments for the message, or null if none |
locale | Locale in which to do lookup |
NoSuchMessageException | if not found |
---|
Retrieve the message for the given code and the given Locale.
code | code of the message |
---|---|
locale | Locale in which to do lookup |
NoSuchMessageException | if not found |
---|
Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance) in the given Locale.
resolvable | the MessageSourceResolvable |
---|---|
locale | Locale in which to do lookup |
NoSuchMessageException | if not found |
---|
Retrieve the message for the given code and the given Locale.
code | code of the message |
---|---|
args | arguments for the message, or null if none |
defaultMessage | String to return if the lookup fails |
locale | Locale in which to do lookup |
Retrieve the message for the given code and the default Locale.
code | code of the message |
---|---|
args | arguments for the message, or null if none |
NoSuchMessageException | if not found |
---|
Retrieve the given MessageSourceResolvable (e.g. an ObjectError instance) in the default Locale.
resolvable | the MessageSourceResolvable |
---|
NoSuchMessageException | if not found |
---|
Return the default locale to use if no explicit locale has been given.
The default implementation returns the default locale passed into the corresponding constructor, or LocaleContextHolder's locale as fallback. Can be overridden in subclasses.