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

Constructor Summary
MapInput()
           
MapInput(Map<String,Object> values)
           
 
Method Summary
 String getHeader(String name)
          Gets a header value from this input.
 Iterator<String> getHeaderKeys()
          Gets an iterator with all header names.
protected  Locale getLocale()
           
 String getProperty(String name)
          Gets a property associated with this input.
 String getString(String name)
           
 String[] getStrings(String name)
           
 String getStringValue(String name)
          Deprecated. use getString instead
 String[] getStringValues(String name)
          Deprecated. use getStrings instead
 Object getValue(String name)
          Gets a parameter value (any object) with the given name.
 boolean has(String key)
          Check if the input has this key (Shorter verions of hasValue)
 boolean hasValue(String name)
          Checks if a value exists.
 Iterator<String> keys()
          Gets an iterator with all the parameter names.
 void removeValue(String name)
          Removes a parameter from this input.
 void setHeader(String name, String value)
           
 void setLocale(Locale loc)
           
 void setProperty(String name, String value)
           
 void setValue(String name, 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, getEnums, getFloat, getFloat, getFloatValue, getFloatValue, getInt, getInt, getInts, getIntValue, getIntValue, getIntValues, getLong, getLong, getLongs, getLongValue, getLongValue, getObject, getObject, getObject, getObject, getObject, getObject, getObject, inject, inject, isB, main
 
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(Map<String,Object> values)
Method Detail

setLocale

public void setLocale(Locale loc)

setHeader

public void setHeader(String name,
                      String value)

getHeader

public String getHeader(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 Iterator<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(String name,
                        String value)

getProperty

public String getProperty(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(String name)
Description copied from interface: Input
Checks if a value exists.

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

has

public boolean has(String key)
Description copied from interface: Input
Check if the input has this key (Shorter verions of hasValue)


getStringValue

public String getStringValue(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 String getString(String name)

keys

public Iterator<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(String name)
Description copied from interface: Input
Removes a parameter from this input.

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

getStringValues

public String[] getStringValues(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 String[] getStrings(String name)

setValue

public void setValue(String name,
                     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 Object getValue(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 Locale getLocale()
Specified by:
getLocale in class AbstractInput


Copyright © 2013. All Rights Reserved.