org.codehaus.plexus.summit.parameters
Interface ParameterConverter

All Known Implementing Classes:
BaseParameterConverter, RequestParameters

public interface ParameterConverter

Interface that provides type-conversion methods for the values of a parameter map. The parameter map consists of name/value pairs. For example, HTTP request parameters obtained via GET/POST data, or Cookies.

Version:
$Revision: 2092 $
Author:
Ilkka Priha, Jon S. Stevens, Sean Legassick, Jason van Zyl, Pete Kazmier

Method Summary
 boolean containsKey(java.lang.Object key)
          Determine whether a given key has been inserted
 java.lang.String get(java.lang.String name)
          Return a String for the given name.
 java.math.BigDecimal getBigDecimal(java.lang.String name)
          Return a BigDecimal for the given name.
 java.math.BigDecimal getBigDecimal(java.lang.String name, java.math.BigDecimal defaultValue)
          Return a BigDecimal for the given name.
 java.math.BigDecimal[] getBigDecimals(java.lang.String name)
          Return an array of BigDecimals for the given name.
 java.lang.Boolean getBool(java.lang.String name)
          Return a Boolean for the given name.
 java.lang.Boolean getBool(java.lang.String name, boolean defaultValue)
          Return a Boolean for the given name.
 boolean getBoolean(java.lang.String name)
          Return a boolean for the given name.
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Return a boolean for the given name.
 byte getByte(java.lang.String name)
          Return a byte for the given name.
 byte getByte(java.lang.String name, byte defaultValue)
          Return a byte for the given name.
 byte[] getBytes(java.lang.String name)
          Return an array of bytes for the given name.
 java.util.Date getDate(java.lang.String name)
          Returns a Date object.
 java.util.Date getDate(java.lang.String name, java.text.DateFormat df)
          Returns a Date object.
 java.util.Date getDate(java.lang.String name, java.text.DateFormat df, java.util.Date defaultValue)
          Returns a Date object.
 double getDouble(java.lang.String name)
          Return a double for the given name.
 double getDouble(java.lang.String name, double defaultValue)
          Return a double for the given name.
 float getFloat(java.lang.String name)
          Return a float for the given name.
 float getFloat(java.lang.String name, float defaultValue)
          Return a float for the given name.
 int getInt(java.lang.String name)
          Return an int for the given name.
 int getInt(java.lang.String name, int defaultValue)
          Return an int for the given name.
 java.lang.Integer getInteger(java.lang.String name)
          Return an Integer for the given name.
 java.lang.Integer getInteger(java.lang.String name, int defaultValue)
          Return an Integer for the given name.
 java.lang.Integer getInteger(java.lang.String name, java.lang.Integer def)
          Return an Integer for the given name.
 java.lang.Integer[] getIntegers(java.lang.String name)
          Return an array of Integers for the given name.
 int[] getInts(java.lang.String name)
          Return an array of ints for the given name.
 java.lang.Object[] getKeys()
          Get an array of all the parameter names.
 long getLong(java.lang.String name)
          Return a long for the given name.
 long getLong(java.lang.String name, long defaultValue)
          Return a long for the given name.
 java.lang.Long[] getLongObjects(java.lang.String name)
          Return an array of Longs for the given name.
 long[] getLongs(java.lang.String name)
          Return an array of longs for the given name.
 java.lang.Object getObject(java.lang.String name)
          Return an Object for the given name.
 java.lang.Object[] getObjects(java.lang.String name)
          Return an array of Objects for the given name.
 java.lang.String getString(java.lang.String name)
          Return a String for the given name.
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
          Return a String for the given name.
 java.lang.String[] getStrings(java.lang.String name)
          Return an array of Strings for the given name.
 java.lang.String[] getStrings(java.lang.String name, java.lang.String[] defaultValue)
          Return an array of Strings for the given name.
 java.util.Iterator keys()
          Get an Iterator for the parameter names.
 

Method Detail

containsKey

boolean containsKey(java.lang.Object key)
Determine whether a given key has been inserted

Parameters:
key - An Object with the key to search for.
Returns:
True if the object is found.

keys

java.util.Iterator keys()
Get an Iterator for the parameter names.

Returns:
An Iterator of the keys.

getKeys

java.lang.Object[] getKeys()
Get an array of all the parameter names.

Returns:
A object array with the keys.

getBoolean

boolean getBoolean(java.lang.String name,
                   boolean defaultValue)
Return a boolean for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A boolean.

getBoolean

boolean getBoolean(java.lang.String name)
Return a boolean for the given name. If the name does not exist, return false.

Parameters:
name - A String with the name.
Returns:
A boolean.

getBool

java.lang.Boolean getBool(java.lang.String name,
                          boolean defaultValue)
Return a Boolean for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A Boolean.

getBool

java.lang.Boolean getBool(java.lang.String name)
Return a Boolean for the given name. If the name does not exist, return false.

Parameters:
name - A String with the name.
Returns:
A Boolean.

getDouble

double getDouble(java.lang.String name,
                 double defaultValue)
Return a double for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A double.

getDouble

double getDouble(java.lang.String name)
Return a double for the given name. If the name does not exist, return 0.0.

Parameters:
name - A String with the name.
Returns:
A double.

getFloat

float getFloat(java.lang.String name,
               float defaultValue)
Return a float for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A float.

getFloat

float getFloat(java.lang.String name)
Return a float for the given name. If the name does not exist, return 0.0.

Parameters:
name - A String with the name.
Returns:
A float.

getBigDecimal

java.math.BigDecimal getBigDecimal(java.lang.String name,
                                   java.math.BigDecimal defaultValue)
Return a BigDecimal for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A BigDecimal.

getBigDecimal

java.math.BigDecimal getBigDecimal(java.lang.String name)
Return a BigDecimal for the given name. If the name does not exist, return 0.0.

Parameters:
name - A String with the name.
Returns:
A BigDecimal.

getBigDecimals

java.math.BigDecimal[] getBigDecimals(java.lang.String name)
Return an array of BigDecimals for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A BigDecimal[].

getInt

int getInt(java.lang.String name,
           int defaultValue)
Return an int for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
An int.

getInt

int getInt(java.lang.String name)
Return an int for the given name. If the name does not exist, return 0.

Parameters:
name - A String with the name.
Returns:
An int.

getInteger

java.lang.Integer getInteger(java.lang.String name,
                             int defaultValue)
Return an Integer for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
An Integer.

getInteger

java.lang.Integer getInteger(java.lang.String name,
                             java.lang.Integer def)
Return an Integer for the given name. If the name does not exist, return defaultValue. You cannot pass in a null here for the default value.

Parameters:
name - A String with the name.
def - The default value.
Returns:
An Integer.

getInteger

java.lang.Integer getInteger(java.lang.String name)
Return an Integer for the given name. If the name does not exist, return 0.

Parameters:
name - A String with the name.
Returns:
An Integer.

getInts

int[] getInts(java.lang.String name)
Return an array of ints for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
An int[].

getIntegers

java.lang.Integer[] getIntegers(java.lang.String name)
Return an array of Integers for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
An Integer[].

getLong

long getLong(java.lang.String name,
             long defaultValue)
Return a long for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A long.

getLong

long getLong(java.lang.String name)
Return a long for the given name. If the name does not exist, return 0.

Parameters:
name - A String with the name.
Returns:
A long.

getLongs

long[] getLongs(java.lang.String name)
Return an array of longs for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A long[].

getLongObjects

java.lang.Long[] getLongObjects(java.lang.String name)
Return an array of Longs for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A Long[].

getByte

byte getByte(java.lang.String name,
             byte defaultValue)
Return a byte for the given name. If the name does not exist, return defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A byte.

getByte

byte getByte(java.lang.String name)
Return a byte for the given name. If the name does not exist, return 0.

Parameters:
name - A String with the name.
Returns:
A byte.

getBytes

byte[] getBytes(java.lang.String name)
                throws java.io.UnsupportedEncodingException
Return an array of bytes for the given name. If the name does not exist, return null. The array is returned according to the HttpRequest's character encoding.

Parameters:
name - A String with the name.
Returns:
A byte[].
Throws:
java.io.UnsupportedEncodingException

getString

java.lang.String getString(java.lang.String name)
Return a String for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A String.

get

java.lang.String get(java.lang.String name)
Return a String for the given name. If the name does not exist, return null. It is the same as the getString() method however has been added for simplicity when working with template tools such as Velocity which allow you to do something like this:

$data.Parameters.form_variable_name

Parameters:
name - A String with the name.
Returns:
A String.

getString

java.lang.String getString(java.lang.String name,
                           java.lang.String defaultValue)
Return a String for the given name. If the name does not exist, return the defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A String.

getStrings

java.lang.String[] getStrings(java.lang.String name)
Return an array of Strings for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A String[].

getStrings

java.lang.String[] getStrings(java.lang.String name,
                              java.lang.String[] defaultValue)
Return an array of Strings for the given name. If the name does not exist, return the defaultValue.

Parameters:
name - A String with the name.
defaultValue - The default value.
Returns:
A String[].

getObject

java.lang.Object getObject(java.lang.String name)
Return an Object for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
An Object.

getObjects

java.lang.Object[] getObjects(java.lang.String name)
Return an array of Objects for the given name. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
An Object[].

getDate

java.util.Date getDate(java.lang.String name,
                       java.text.DateFormat df,
                       java.util.Date defaultValue)
Returns a Date object. String is parsed by supplied DateFormat. If the name does not exist, return the defaultValue.

Parameters:
name - A String with the name.
df - A DateFormat.
defaultValue - The default value.
Returns:
A Date.

getDate

java.util.Date getDate(java.lang.String name,
                       java.text.DateFormat df)
Returns a Date object. String is parsed by supplied DateFormat. If the name does not exist, return null.

Parameters:
name - A String with the name.
df - A DateFormat.
Returns:
A Date.

getDate

java.util.Date getDate(java.lang.String name)
Returns a Date object. String is parsed by supplied DateFormat. If the name does not exist, return null.

Parameters:
name - A String with the name.
Returns:
A Date.


Copyright © 2001-2006 Codehaus. All Rights Reserved.