|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.context.support.AbstractMessageSource org.springframework.context.support.StaticMessageSource
public class StaticMessageSource
Simple implementation of MessageSource
which allows messages to be registered programmatically.
This MessageSource supports basic internationalization.
Intended for testing rather than for use in production systems.
Field Summary |
---|
Fields inherited from class org.springframework.context.support.AbstractMessageSource |
---|
logger |
Constructor Summary | |
---|---|
StaticMessageSource()
|
Method Summary | |
---|---|
void |
addMessage(String code,
Locale locale,
String msg)
Associate the given message with the given code. |
void |
addMessages(Map messages,
Locale locale)
Associate the given message values with the given keys as codes. |
protected MessageFormat |
resolveCode(String code,
Locale locale)
Subclasses must implement this method to resolve a message. |
String |
toString()
|
Methods inherited from class org.springframework.context.support.AbstractMessageSource |
---|
createMessageFormat, formatMessage, getDefaultMessage, getMessage, getMessage, getMessage, getMessageFromParent, getMessageInternal, getParentMessageSource, isAlwaysUseMessageFormat, isUseCodeAsDefaultMessage, renderDefaultMessage, resolveArguments, resolveCodeWithoutArguments, setAlwaysUseMessageFormat, setParentMessageSource, setUseCodeAsDefaultMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StaticMessageSource()
Method Detail |
---|
protected MessageFormat resolveCode(String code, Locale locale)
AbstractMessageSource
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 resolveCodeWithoutArguments
javadoc for details.
resolveCode
in class AbstractMessageSource
code
- the code of the message to resolvelocale
- the Locale to resolve the code for
(subclasses are encouraged to support internationalization)
null
if not foundAbstractMessageSource.resolveCodeWithoutArguments(String, java.util.Locale)
public void addMessage(String code, Locale locale, String msg)
code
- the lookup codelocale
- the locale that the message should be found withinmsg
- the message associated with this lookup codepublic void addMessages(Map messages, Locale locale)
messages
- the messages to register, with messages codes
as keys and message texts as valueslocale
- the locale that the messages should be found withinpublic String toString()
toString
in class Object
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |