org.codehaus.plexus.summit.parameters
Interface ParameterConverter

All Known Implementing Classes:
BaseParameterConverter

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

public 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

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

Returns:
An Iterator of the keys.

getKeys

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

Returns:
A object array with the keys.

getBoolean

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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-2007 Codehaus. All Rights Reserved.