org.mentawai.core
Class AbstractInput

java.lang.Object
  extended by org.mentawai.core.AbstractInput
All Implemented Interfaces:
Input
Direct Known Subclasses:
MapInput, RequestInput

public abstract class AbstractInput
extends java.lang.Object
implements Input


Field Summary
 
Fields inherited from interface org.mentawai.core.Input
DEFAULT_CHARSET
 
Constructor Summary
AbstractInput()
           
 
Method Summary
 boolean getBoolean(java.lang.String name)
          Calls getStringValue() and tries to convert the string to boolean.
 boolean getBoolean(java.lang.String name, boolean def)
           
 boolean getBooleanValue(java.lang.String name)
          Deprecated. use getBoolean instead
 boolean getBooleanValue(java.lang.String name, boolean def)
          Deprecated. use getBoolean instead
 java.util.Date getDate(java.lang.String name)
          Parse a parameter value from this input as a Date.
 java.util.Date getDate(java.lang.String name, int style)
          Parse a parameter value from this action input as a Date using the given style.
 java.util.Date getDate(java.lang.String name, java.lang.String pattern)
          Parse a parameter value from this action input as a Date using the given pattern.
 double getDouble(java.lang.String name)
          Calls getString() and tries to convert the string to a double.
 double getDouble(java.lang.String name, double def)
           
 double getDoubleValue(java.lang.String name)
          Deprecated. use getDouble instead
 double getDoubleValue(java.lang.String name, double def)
          Deprecated. use getDouble instead
<E extends java.lang.Enum<E>>
E
getEnum(java.lang.String key, java.lang.Class<E> enumClass)
          Convert the parameter value from this action input as an Enum.
 float getFloat(java.lang.String name)
          Calls getString() and tries to convert the string to a float.
 float getFloat(java.lang.String name, float def)
           
 float getFloatValue(java.lang.String name)
          Deprecated. use getFloat instead
 float getFloatValue(java.lang.String name, float def)
          Deprecated. use getFloat instead
 int getInt(java.lang.String name)
           
 int getInt(java.lang.String name, int def)
           
 int[] getInts(java.lang.String name)
           
 int getIntValue(java.lang.String name)
          Deprecated. use getInt instead
 int getIntValue(java.lang.String name, int def)
          Deprecated. use getInt instead
 int[] getIntValues(java.lang.String name)
          Deprecated. Use getInts instead
protected abstract  java.util.Locale getLocale()
           
 long getLong(java.lang.String name)
          Calls getString() and tries to convert the string to a long.
 long getLong(java.lang.String name, long def)
           
 long getLongValue(java.lang.String name)
          Deprecated. use getLong instead
 long getLongValue(java.lang.String name, long def)
          Deprecated. use getLong instead
<E> E
getObject(java.lang.Class<? extends E> klass)
          Gets a populated object with the values from the action input.
<E> E
getObject(java.lang.Class<? extends E> klass, java.lang.String prefix)
          Gets a populated object with the values from the action input.
<E> E
getObject(E bean)
          Gets a populated object with the values from the action input.
<E> E
getObject(E bean, java.lang.String prefix)
          Gets a populated object with the values from the action input.
<E> E
getObject(E target, java.lang.String prefix, boolean tryField, boolean tryToConvert, boolean convertBoolean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mentawai.core.Input
getHeader, getHeaderKeys, getProperty, getString, getStrings, getStringValue, getStringValues, getValue, hasValue, keys, removeValue, setValue
 

Constructor Detail

AbstractInput

public AbstractInput()
Method Detail

getBoolean

public boolean getBoolean(java.lang.String name)
Calls getStringValue() and tries to convert the string to boolean.

Specified by:
getBoolean in interface Input

getBooleanValue

public boolean getBooleanValue(java.lang.String name)
Deprecated. use getBoolean instead

Description copied from interface: Input
Gets a parameter value from this input as a boolean.

Specified by:
getBooleanValue in interface Input
Parameters:
name - the parameter's name
Returns:
the parameters's value as a boolean

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean def)
Specified by:
getBoolean in interface Input

getBooleanValue

public boolean getBooleanValue(java.lang.String name,
                               boolean def)
Deprecated. use getBoolean instead

Description copied from interface: Input
Gets a parameter value from this input as a boolean.

Specified by:
getBooleanValue in interface Input
Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a boolean or def if not found

getDate

public java.util.Date getDate(java.lang.String name)
Description copied from interface: Input
Parse a parameter value from this input as a Date.

Specified by:
getDate in interface Input
Parameters:
name - the parameter's name
Returns:
the parameter's value as a Date or null if it doesn't exist

getDate

public java.util.Date getDate(java.lang.String name,
                              int style)
Description copied from interface: Input
Parse a parameter value from this action input as a Date using the given style.

Specified by:
getDate in interface Input
Parameters:
name - the parameter's name
style - the DateFormat style to be used
Returns:
the parameter's value as a Date or null if it doesn't exist

getDate

public java.util.Date getDate(java.lang.String name,
                              java.lang.String pattern)
Description copied from interface: Input
Parse a parameter value from this action input as a Date using the given pattern.

Specified by:
getDate in interface Input
Parameters:
name - the parameter's name
pattern - The SimpleDateFormat pattern to be used
Returns:
the parameter's value as a Date or null if it doesn't exist

getLocale

protected abstract java.util.Locale getLocale()

getDouble

public double getDouble(java.lang.String name)
Calls getString() and tries to convert the string to a double.

Specified by:
getDouble in interface Input

getDoubleValue

public double getDoubleValue(java.lang.String name)
Deprecated. use getDouble instead

Description copied from interface: Input
Gets a parameter value from this input as a double.

Specified by:
getDoubleValue in interface Input
Parameters:
name - the parameter's name
Returns:
the parameters's value as a double

getDouble

public double getDouble(java.lang.String name,
                        double def)
Specified by:
getDouble in interface Input

getDoubleValue

public double getDoubleValue(java.lang.String name,
                             double def)
Deprecated. use getDouble instead

Description copied from interface: Input
Gets a parameter value from this input as a double.

Specified by:
getDoubleValue in interface Input
Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a double or def if not found

getFloat

public float getFloat(java.lang.String name)
Calls getString() and tries to convert the string to a float.

Specified by:
getFloat in interface Input

getFloatValue

public float getFloatValue(java.lang.String name)
Deprecated. use getFloat instead

Description copied from interface: Input
Gets a parameter value from this input as a float.

Specified by:
getFloatValue in interface Input
Parameters:
name - the parameter's name
Returns:
the parameters's value as a float

getFloat

public float getFloat(java.lang.String name,
                      float def)
Specified by:
getFloat in interface Input

getFloatValue

public float getFloatValue(java.lang.String name,
                           float def)
Deprecated. use getFloat instead

Description copied from interface: Input
Gets a parameter value from this input as a float.

Specified by:
getFloatValue in interface Input
Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a float or def if not found

getIntValue

public int getIntValue(java.lang.String name)
Deprecated. use getInt instead

Description copied from interface: Input
Gets a parameter value from this input as an int.

Specified by:
getIntValue in interface Input
Parameters:
name - the parameter's name
Returns:
the parameters's value as an int

getInt

public int getInt(java.lang.String name)
Specified by:
getInt in interface Input

getIntValue

public int getIntValue(java.lang.String name,
                       int def)
Deprecated. use getInt instead

Description copied from interface: Input
Gets a parameter value from this input as an int.

Specified by:
getIntValue in interface Input
Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as an int or def if not found

getInt

public int getInt(java.lang.String name,
                  int def)
Specified by:
getInt in interface Input

getInts

public int[] getInts(java.lang.String name)
Specified by:
getInts in interface Input

getIntValues

public int[] getIntValues(java.lang.String name)
Deprecated. Use getInts instead

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

Specified by:
getIntValues in interface Input
Parameters:
name - the parameters'name
Returns:
a int array with all the values or null if the don't exist.

getLong

public long getLong(java.lang.String name)
Calls getString() and tries to convert the string to a long.

Specified by:
getLong in interface Input

getLongValue

public long getLongValue(java.lang.String name)
Deprecated. use getLong instead

Description copied from interface: Input
Gets a parameter value from this input as a long.

Specified by:
getLongValue in interface Input
Parameters:
name - the parameter's name
Returns:
the parameters's value as a long

getLong

public long getLong(java.lang.String name,
                    long def)
Specified by:
getLong in interface Input

getLongValue

public long getLongValue(java.lang.String name,
                         long def)
Deprecated. use getLong instead

Description copied from interface: Input
Gets a parameter value from this input as a long.

Specified by:
getLongValue in interface Input
Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a long or def if not found

getObject

public <E> E getObject(java.lang.Class<? extends E> klass)
Description copied from interface: Input
Gets a populated object with the values from the action input. OBS: Excelent idea given by Bruno Braga!

Specified by:
getObject in interface Input
Returns:
The populated object

getObject

public <E> E getObject(java.lang.Class<? extends E> klass,
                       java.lang.String prefix)
Description copied from interface: Input
Gets a populated object with the values from the action input. Use the prefix in front of every value name. OBS: Excelent idea given by Bruno Braga!

Specified by:
getObject in interface Input
Returns:
The populated object

getObject

public <E> E getObject(E bean)
Description copied from interface: Input
Gets a populated object with the values from the action input.

Specified by:
getObject in interface Input
Returns:
The populated object

getObject

public <E> E getObject(E bean,
                       java.lang.String prefix)
Description copied from interface: Input
Gets a populated object with the values from the action input. Use the prefix in front of every value name.

Specified by:
getObject in interface Input
Returns:
The populated object

getObject

public <E> E getObject(E target,
                       java.lang.String prefix,
                       boolean tryField,
                       boolean tryToConvert,
                       boolean convertBoolean)

getEnum

public <E extends java.lang.Enum<E>> E getEnum(java.lang.String key,
                                               java.lang.Class<E> enumClass)
Description copied from interface: Input
Convert the parameter value from this action input as an Enum.

Specified by:
getEnum in interface Input
Parameters:
key - the parameter's name
enumClass - the Enum's class
Returns:
Return the Enumeration


Copyright © 2005 Mentawai Team. All Rights Reserved.