org.springframework.context.MessageSource
which allows messages to be registered programmatically.
This MessageSource supports basic internationalization.
Intended for testing rather than for use in production systems.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addMessage(String
the lookup code code, Locale the locale that the message should be found within locale, String the message associated with this lookup code msg)Associate the given message with the given code. |
| public void | addMessages(Map<String, String>
the messages to register, with messages codes
as keys and message texts as values messages, Locale the locale that the messages should be found within locale)Associate the given message values with the given keys as codes. |
| protected MessageFormat | resolveCode(String
the code of the message to resolve code, Locale the locale to resolve the code for
(subclasses are encouraged to support internationalization) locale)Implements abstract org. |
| protected String | resolveCodeWithoutArguments(String
the code of the message to resolve code, Locale the locale to resolve the code for
(subclasses are encouraged to support internationalization) locale)Overrides org. |
| public String |
| messageMap | back to summary |
|---|---|
| private final Map<String, Map<Locale, StaticMessageSource. | |
| StaticMessageSource | back to summary |
|---|---|
| public StaticMessageSource() | |
| addMessage | back to summary |
|---|---|
| public void addMessage(String code, Locale locale, String msg) Associate the given message with the given code. | |
| addMessages | back to summary |
|---|---|
| public void addMessages(Map<String, String> messages, Locale locale) Associate the given message values with the given keys as codes. | |
| resolveCode | back to summary |
|---|---|
| protected MessageFormat resolveCode(String code, Locale locale) Implements abstract org. Doc from org. Subclasses must implement this method to resolve a message. Returns a MessageFormat instance rather than a message String, to allow for appropriate caching of MessageFormats in subclasses. Subclasses are encouraged to provide optimized resolution
for messages without arguments, not involving MessageFormat.
See the
| |
| resolveCodeWithoutArguments | back to summary |
|---|---|
| protected String resolveCodeWithoutArguments(String code, Locale locale) Overrides org. Doc from org. Subclasses can override this method to resolve a message without arguments in an optimized fashion, i.e. to resolve without involving a MessageFormat. The default implementation does use MessageFormat, through
delegating to the Unfortunately, | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| private volatile MessageFormat | |
| private final Locale | |
| private final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public MessageFormat | |
| public String |
| cachedFormat | back to summary |
|---|---|
| private volatile MessageFormat cachedFormat
| |
| locale | back to summary |
|---|---|
| private final Locale locale | |
| message | back to summary |
|---|---|
| private final String message | |
| MessageHolder | back to summary |
|---|---|
| public MessageHolder(String message, Locale locale) | |
| getMessage | back to summary |
|---|---|
| public String getMessage() | |
| getMessageFormat | back to summary |
|---|---|
| public MessageFormat getMessageFormat() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |