|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.util.MessageResources com.mockrunner.struts.MapMessageResources
public class MapMessageResources
This implementation of MessageResources
takes the messages from a Map
and can be
used for testing purposes. The Map
can
also be filled with the contents of a property file.
Note: This implementation ignores the specified Locale
.
Field Summary |
---|
Fields inherited from class org.apache.struts.util.MessageResources |
---|
config, defaultFactory, defaultLocale, factory, formats, returnNull |
Constructor Summary | |
---|---|
MapMessageResources()
Creates an empty resources object |
|
MapMessageResources(java.util.Map messages)
Creates a resources object based on the specified map. |
|
MapMessageResources(java.util.Map messages,
org.apache.struts.util.MessageResourcesFactory factory,
java.lang.String config)
Creates a resources object based on the specified map. |
|
MapMessageResources(java.util.Map messages,
org.apache.struts.util.MessageResourcesFactory factory,
java.lang.String config,
boolean returnNull)
Creates a resources object based on the specified map. |
Method Summary | |
---|---|
void |
clear()
Clears all messages. |
java.lang.String |
getMessage(java.util.Locale locale,
java.lang.String key)
Returns the message for the specified key. |
void |
putMessage(java.lang.String key,
java.lang.String value)
Adds a message for the specified key. |
void |
putMessages(java.io.File propertyFile)
Loads a property file and adds all messages from the file. |
void |
putMessages(java.util.Map messages)
Adds all messages in the specified map. |
void |
putMessages(java.lang.String propertyFileName)
Loads a property file and adds all messages from the file. |
Methods inherited from class org.apache.struts.util.MessageResources |
---|
escape, getConfig, getFactory, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessage, getMessageResources, getReturnNull, isEscape, isPresent, isPresent, localeKey, log, log, messageKey, messageKey, setEscape, setReturnNull |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapMessageResources()
public MapMessageResources(java.util.Map messages)
messages
- the map of messagespublic MapMessageResources(java.util.Map messages, org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config)
messages
- the map of messagesfactory
- the MessageResourcesFactory that created usconfig
- the configuration parameterpublic MapMessageResources(java.util.Map messages, org.apache.struts.util.MessageResourcesFactory factory, java.lang.String config, boolean returnNull)
messages
- the map of messagesfactory
- the MessageResourcesFactory that created usconfig
- the configuration parameterreturnNull
- the returnNull propertyMethod Detail |
---|
public java.lang.String getMessage(java.util.Locale locale, java.lang.String key)
getMessage
in class org.apache.struts.util.MessageResources
locale
- the locale (ignored)key
- the message key
public void putMessage(java.lang.String key, java.lang.String value)
key
- the message keyvalue
- the messagepublic void putMessages(java.util.Map messages)
messages
- the message mappublic void putMessages(java.lang.String propertyFileName)
propertyFileName
- the file namepublic void putMessages(java.io.File propertyFile)
propertyFile
- the filepublic void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |