org.mentawai.core
Class MapOutput

java.lang.Object
  extended by org.mentawai.core.MapOutput
All Implemented Interfaces:
Output

public class MapOutput
extends java.lang.Object
implements Output

A simple Output implementation backed up by a java.util.HashMap. You may use this class as a mock for testing.

Author:
Sergio Oliveira

Constructor Summary
MapOutput()
           
 
Method Summary
 java.lang.Object getValue(java.lang.String name)
          Gets an output value by name.
 boolean isEmpty()
          Returns true is this output has no values.
 java.util.Iterator<java.lang.String> keys()
          Gets an iterator with the names of each output value.
 void removeValue(java.lang.String name)
          Removes an output value by name.
 void setObject(java.lang.Object bean)
          Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.
 void setObject(java.lang.Object bean, java.lang.String prefix)
          Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.
 void setValue(java.lang.String name, java.lang.Object value)
          Sets an output value by name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapOutput

public MapOutput()
Method Detail

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Description copied from interface: Output
Sets an output value by name.

Specified by:
setValue in interface Output
Parameters:
name - The name of the value
value - The value

getValue

public java.lang.Object getValue(java.lang.String name)
Description copied from interface: Output
Gets an output value by name.

Specified by:
getValue in interface Output
Parameters:
name - The name of the value
Returns:
The value or null if it does not exist

removeValue

public void removeValue(java.lang.String name)
Description copied from interface: Output
Removes an output value by name.

Specified by:
removeValue in interface Output
Parameters:
name - The name of the value

isEmpty

public boolean isEmpty()
Description copied from interface: Output
Returns true is this output has no values.

Specified by:
isEmpty in interface Output
Returns:
true if this output has no values

setObject

public void setObject(java.lang.Object bean)
Description copied from interface: Output
Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output.

Specified by:
setObject in interface Output
Parameters:
bean - The bean (object) from where to get the properties.

setObject

public void setObject(java.lang.Object bean,
                      java.lang.String prefix)
Description copied from interface: Output
Sets the properties of the given bean in the action output, in other words, extract all attributes from the given object and place them in the action output. Use the given prefix when placing in the output.

Specified by:
setObject in interface Output
Parameters:
bean - The bean (object) from where to get the properties.
prefix - The prefix to use when placing the properties in the output.

keys

public java.util.Iterator<java.lang.String> keys()
Description copied from interface: Output
Gets an iterator with the names of each output value.

Specified by:
keys in interface Output
Returns:
An iterator with all the names


Copyright © 2005 Mentawai Team. All Rights Reserved.