org.mentawai.core
Class MapInput

java.lang.Object
  extended by org.mentawai.core.AbstractInput
      extended by org.mentawai.core.MapInput
All Implemented Interfaces:
Input

public class MapInput
extends AbstractInput

A simple Input that can be used for testing.

Author:
Sergio Oliveira

Field Summary
 
Fields inherited from interface org.mentawai.core.Input
DEFAULT_CHARSET
 
Constructor Summary
MapInput()
           
MapInput(java.util.Map<java.lang.String,java.lang.Object> values)
           
 
Method Summary
 java.lang.String getHeader(java.lang.String name)
          Gets a header value from this input.
 java.util.Iterator<java.lang.String> getHeaderKeys()
          Gets an iterator with all header names.
protected  java.util.Locale getLocale()
           
 java.lang.String getProperty(java.lang.String name)
          Gets a property associated with this input.
 java.lang.String getString(java.lang.String name)
           
 java.lang.String[] getStrings(java.lang.String name)
           
 java.lang.String getStringValue(java.lang.String name)
          Deprecated. use getString instead
 java.lang.String[] getStringValues(java.lang.String name)
          Deprecated. use getStrings instead
 java.lang.Object getValue(java.lang.String name)
          Gets a parameter value (any object) with the given name.
 boolean hasValue(java.lang.String name)
          Checks if a value exists.
 java.util.Iterator<java.lang.String> keys()
          Gets an iterator with all the parameter names.
 void removeValue(java.lang.String name)
          Removes a parameter from this input.
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setLocale(java.util.Locale loc)
           
 void setProperty(java.lang.String name, java.lang.String value)
           
 void setValue(java.lang.String name, java.lang.Object value)
          Sets a parameter value with the given name.
 
Methods inherited from class org.mentawai.core.AbstractInput
getBoolean, getBoolean, getBooleanValue, getBooleanValue, getDate, getDate, getDate, getDouble, getDouble, getDoubleValue, getDoubleValue, getEnum, getFloat, getFloat, getFloatValue, getFloatValue, getInt, getInt, getInts, getIntValue, getIntValue, getIntValues, getLong, getLong, getLongValue, getLongValue, getObject, getObject, getObject, getObject, getObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapInput

public MapInput()

MapInput

public MapInput(java.util.Map<java.lang.String,java.lang.Object> values)
Method Detail

setLocale

public void setLocale(java.util.Locale loc)

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)

getHeader

public java.lang.String getHeader(java.lang.String name)
Description copied from interface: Input
Gets a header value from this input.

Parameters:
name - the header name
Returns:
the header value

getHeaderKeys

public java.util.Iterator<java.lang.String> getHeaderKeys()
Description copied from interface: Input
Gets an iterator with all header names.

Returns:
an iterator with all header names

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: Input
Gets a property associated with this input.

Parameters:
name - the name of the property
Returns:
the value of the property as a String

hasValue

public boolean hasValue(java.lang.String name)
Description copied from interface: Input
Checks if a value exists.

Parameters:
name - The name of the key.
Returns:
true if exists

getStringValue

public java.lang.String getStringValue(java.lang.String name)
Deprecated. use getString instead

Description copied from interface: Input
Gets a parameter value from this input as a String. If this object is not a String, the toString() method is called.

Parameters:
name - the parameter's name
Returns:
the parameter's value as a string or null if it doesn't exist

getString

public java.lang.String getString(java.lang.String name)

keys

public java.util.Iterator<java.lang.String> keys()
Description copied from interface: Input
Gets an iterator with all the parameter names.

Returns:
an iterator with all the parameter names.

removeValue

public void removeValue(java.lang.String name)
Description copied from interface: Input
Removes a parameter from this input.

Parameters:
name - the name of the parameter to remove.

getStringValues

public java.lang.String[] getStringValues(java.lang.String name)
Deprecated. use getStrings instead

Description copied from interface: Input
Gets all parameter values with the given name as a string array.

Parameters:
name - the parameters'name
Returns:
a string array with all the values or null if they don't exist.

getStrings

public java.lang.String[] getStrings(java.lang.String name)

setValue

public void setValue(java.lang.String name,
                     java.lang.Object value)
Description copied from interface: Input
Sets a parameter value with the given name. The parameter can be any object. If the parameter already exists the old value is substituted by the new one.

Parameters:
name - the name of the parameter
value - the parameter value (any object)

getValue

public java.lang.Object getValue(java.lang.String name)
Description copied from interface: Input
Gets a parameter value (any object) with the given name.

Parameters:
name - the name of the parameter
Returns:
the parameter value (any object) or null if it doesn't exist.

getLocale

protected java.util.Locale getLocale()
Specified by:
getLocale in class AbstractInput


Copyright © 2005 Mentawai Team. All Rights Reserved.