org.mentawai.core
Interface Input

All Known Implementing Classes:
AbstractInput, ActionContextFilter, ApplicationFilter, AutoWiringFilter, ConnectionFilter, CookiesFilter, DIFilter, ErrorsFilter, FieldErrorsFilter, HeadersFilter, HibernateAnnotationFilter, HibernateFilter, InputWrapper, IoCFilter, JpaFilter, MapInput, MessagesFilter, OutputFilter, PostOrGetFilter, PrettyURLRequestInput, RequestInput, SessionFilter, SpringInput

public interface Input

Defines the behavior of an action input. An Input has parameters and headers. Parameters can be any java object, and not only strings. Headers can be only strings. Parameters are not read-only, and actions and filters can modify it, if they need to. Headers are read-only.

Author:
Sergio Oliveira

Field Summary
static java.lang.String DEFAULT_CHARSET
          Default charset for input.getString and getStrings
 
Method Summary
 boolean getBoolean(java.lang.String name)
           
 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)
           
 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 name, java.lang.Class<E> enumClass)
          Convert the parameter value from this action input as an Enum.
 float getFloat(java.lang.String name)
           
 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
 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.
 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.
 long getLong(java.lang.String name)
           
 long getLong(java.lang.String name, long def)
           
 long getLongValue(java.lang.String name)
          Deprecated. getLong instead
 long getLongValue(java.lang.String name, long def)
          Deprecated. 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.
 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 setValue(java.lang.String name, java.lang.Object value)
          Sets a parameter value with the given name.
 

Field Detail

DEFAULT_CHARSET

static final java.lang.String DEFAULT_CHARSET
Default charset for input.getString and getStrings

Method Detail

getHeader

java.lang.String getHeader(java.lang.String name)
Gets a header value from this input.

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

getHeaderKeys

java.util.Iterator<java.lang.String> getHeaderKeys()
Gets an iterator with all header names.

Returns:
an iterator with all header names

hasValue

boolean hasValue(java.lang.String name)
Checks if a value exists.

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

getProperty

java.lang.String getProperty(java.lang.String name)
Gets a property associated with this input.

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

getStringValue

java.lang.String getStringValue(java.lang.String name)
Deprecated. Use getString instead

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

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

getIntValue

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

Gets a parameter value from this input as an int.

Parameters:
name - the parameter's name
Returns:
the parameters's value as an int
Throws:
java.lang.NullPointerException - if the value does not exist.
InputException - is the value cannot be converted to an int.

getInt

int getInt(java.lang.String name)

getStringValues

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

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

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

getIntValues

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

Gets all parameter values with the given name as an int array.

Parameters:
name - the parameters'name
Returns:
a int array with all the values or null if the don't exist.
Throws:
InputException - if any of the values cannot be converted to an int.

getInts

int[] getInts(java.lang.String name)

setValue

void setValue(java.lang.String name,
              java.lang.Object value)
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

java.lang.Object getValue(java.lang.String name)
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.

removeValue

void removeValue(java.lang.String name)
Removes a parameter from this input.

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

keys

java.util.Iterator<java.lang.String> keys()
Gets an iterator with all the parameter names.

Returns:
an iterator with all the parameter names.

getIntValue

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

Gets a parameter value from this input as an int.

Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as an int or def if not found
Throws:
InputException - is the value cannot be converted to an int.

getInt

int getInt(java.lang.String name,
           int def)

getLongValue

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

Gets a parameter value from this input as a long.

Parameters:
name - the parameter's name
Returns:
the parameters's value as a long
Throws:
java.lang.NullPointerException - if the value does not exist.
InputException - is the value cannot be converted to a long

getLong

long getLong(java.lang.String name)

getLongValue

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

Gets a parameter value from this input as a long.

Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a long or def if not found
Throws:
InputException - is the value cannot be converted to a long.

getLong

long getLong(java.lang.String name,
             long def)

getBooleanValue

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

Gets a parameter value from this input as a boolean.

Parameters:
name - the parameter's name
Returns:
the parameters's value as a boolean
Throws:
java.lang.NullPointerException - if the value does not exist.
InputException - is the value cannot be converted to a boolean.

getBoolean

boolean getBoolean(java.lang.String name)

getBooleanValue

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

Gets a parameter value from this input as a boolean.

Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a boolean or def if not found
Throws:
InputException - is the value cannot be converted to a boolean.

getBoolean

boolean getBoolean(java.lang.String name,
                   boolean def)

getFloatValue

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

Gets a parameter value from this input as a float.

Parameters:
name - the parameter's name
Returns:
the parameters's value as a float
Throws:
java.lang.NullPointerException - if the value does not exist.
InputException - is the value cannot be converted to a float.

getFloat

float getFloat(java.lang.String name)

getFloatValue

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

Gets a parameter value from this input as a float.

Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a float or def if not found
Throws:
InputException - is the value cannot be converted to a float.

getFloat

float getFloat(java.lang.String name,
               float def)

getDoubleValue

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

Gets a parameter value from this input as a double.

Parameters:
name - the parameter's name
Returns:
the parameters's value as a double
Throws:
java.lang.NullPointerException - if the value does not exist.
InputException - is the value cannot be converted to a double

getDouble

double getDouble(java.lang.String name)

getDoubleValue

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

Gets a parameter value from this input as a double.

Parameters:
name - the parameter's name
def - default value to return
Returns:
the parameters's value as a double or def if not found
Throws:
InputException - is the value cannot be converted to a double.

getDouble

double getDouble(java.lang.String name,
                 double def)

getObject

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

Parameters:
klass -
Returns:
The populated object
Since:
1.8

getObject

<E> E getObject(E bean)
Gets a populated object with the values from the action input.

Parameters:
bean -
Returns:
The populated object
Since:
1.11

getObject

<E> E getObject(java.lang.Class<? extends E> klass,
                java.lang.String prefix)
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!

Parameters:
klass -
prefix -
Returns:
The populated object
Since:
1.8

getObject

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

Parameters:
bean -
prefix -
Returns:
The populated object
Since:
1.11

getDate

java.util.Date getDate(java.lang.String name)
Parse a parameter value from this input as a Date.

Parameters:
name - the parameter's name
Returns:
the parameter's value as a Date or null if it doesn't exist
Throws:
InputException - throws if the attributte can't be parsed

getDate

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.

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
Throws:
InputException - throws if the attributte can't be parsed

getDate

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.

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
Throws:
InputException - throws if the attributte can't be parsed

getEnum

<E extends java.lang.Enum<E>> E getEnum(java.lang.String name,
                                        java.lang.Class<E> enumClass)
Convert the parameter value from this action input as an Enum.

Parameters:
name - the parameter's name
enumClass - the Enum's class
Returns:
Return the Enumeration


Copyright © 2005 Mentawai Team. All Rights Reserved.