Class StaticMessageSource

All Implemented Interfaces:
MessageSource, NestingMessageSource

public class StaticMessageSource
extends AbstractNestingMessageSource

Simple implementation of NestingMessageSource that allows messages to be held in a Java object, and added programmatically. This class now supports internationalization.

Intended for testing, rather than use production systems.

Rod Johnson

Constructor Summary
Method Summary
 void addMessage(java.lang.String code, java.util.Locale locale, java.lang.String message)
          Associate the given message with the given code.
protected  java.lang.String resolve(java.lang.String code, java.util.Locale locale)
          Subclasses must implement this method to resolve a message
Methods inherited from class
escape, getDefaultLocale, getMessage, getMessage, getMessage, localeKey, messageKey, messageKey, setParent
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public StaticMessageSource()
Method Detail


protected java.lang.String resolve(java.lang.String code,
                                   java.util.Locale locale)
Description copied from class: AbstractNestingMessageSource
Subclasses must implement this method to resolve a message
resolve in class AbstractNestingMessageSource
See Also:
AbstractNestingMessageSource.messageKey(Locale, String)


public void addMessage(java.lang.String code,
                       java.util.Locale locale,
                       java.lang.String message)
Associate the given message with the given code.
code - lookup code
locale - locale message should be found within
message - message associated with this lookup code

Rod Johnson and Spring contributors 2001-2003.