Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jcorporate.expresso.core.misc.upload
Interface ValueParser  view ValueParser download ValueParser.java

All Known Subinterfaces:
ParameterParser
All Known Implementing Classes:
BaseValueParser, DefaultParameterParser

public interface ValueParser

ValueParser is a base interface for classes that need to parse name/value Parameters, for example GET/POST data or Cookies (ParameterParser and CookieParser)

NOTE: The name= portion of a name=value pair may be converted to lowercase or uppercase when the object is initialized and when new data is added. This behaviour is determined by the url.case.folding property in TurbineResources.properties. Adding a name/value pair may overwrite existing name=value pairs if the names match:

Version:
$Id: ValueParser.java,v 1.6 2004/11/17 20:48:13 lhamel Exp $

Field Summary
static java.lang.String URL_CASE_FOLDING
          The case folding property specifying the case folding to apply to value keys of the parser.
static java.lang.String URL_CASE_FOLDING_LOWER
           
static java.lang.String URL_CASE_FOLDING_NONE
           
static java.lang.String URL_CASE_FOLDING_UPPER
           
 
Method Summary
 void add(java.lang.String name, double value)
          Add a name/value pair into this object.
 void add(java.lang.String name, int value)
          Add a name/value pair into this object.
 void add(java.lang.String name, java.lang.Integer value)
          Add a name/value pair into this object.
 void add(java.lang.String name, long value)
          Add a name/value pair into this object.
 void add(java.lang.String name, java.lang.String value)
          Add a name/value pair into this object.
 void append(java.lang.String name, java.lang.String value)
          Add a String parameters.
 void clear()
          Clear all name/value pairs out of this object.
 boolean containsKey(java.lang.Object key)
          Determine whether a given key has been inserted.
 java.lang.String convert(java.lang.String value)
          Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING.
 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.lang.String getCharacterEncoding()
          Get the character encoding that will be used by this ValueParser.
 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()
           
 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.Enumeration keys()
           
 java.lang.Object remove(java.lang.String name)
          Removes the named parameter from the contained hashtable.
 void setCharacterEncoding(java.lang.String s)
          Set the character encoding that will be used by this ValueParser.
 void setProperties(java.lang.Object bean)
          Uses bean introspection to set writable properties of bean from the parameters, where a (case-insensitive) name match between the bean property and the parameter is looked for.
 void setString(java.lang.String name, java.lang.String value)
          Set a parameter to a specific value.
 void setStrings(java.lang.String name, java.lang.String[] values)
          Set a parameter to a specific value.
 java.lang.String toString()
          Simple method that attempts to get a toString() representation of this object.
 

Field Detail

URL_CASE_FOLDING

public static final java.lang.String URL_CASE_FOLDING
The case folding property specifying the case folding to apply to value keys of the parser.

See Also:
Constant Field Values

URL_CASE_FOLDING_NONE

public static final java.lang.String URL_CASE_FOLDING_NONE
See Also:
Constant Field Values

URL_CASE_FOLDING_LOWER

public static final java.lang.String URL_CASE_FOLDING_LOWER
See Also:
Constant Field Values

URL_CASE_FOLDING_UPPER

public static final java.lang.String URL_CASE_FOLDING_UPPER
See Also:
Constant Field Values
Method Detail

clear

public void clear()
Clear all name/value pairs out of this object.


setCharacterEncoding

public void setCharacterEncoding(java.lang.String s)
Set the character encoding that will be used by this ValueParser.


getCharacterEncoding

public java.lang.String getCharacterEncoding()
Get the character encoding that will be used by this ValueParser.


convert

public java.lang.String convert(java.lang.String value)
Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. It returns a new string so that it does not destroy the value data.


add

public void add(java.lang.String name,
                double value)
Add a name/value pair into this object.


add

public void add(java.lang.String name,
                int value)
Add a name/value pair into this object.


add

public void add(java.lang.String name,
                java.lang.Integer value)
Add a name/value pair into this object.


add

public void add(java.lang.String name,
                long value)
Add a name/value pair into this object.


add

public void add(java.lang.String name,
                java.lang.String value)
Add a name/value pair into this object.


append

public void append(java.lang.String name,
                   java.lang.String value)
Add a String parameters. If there are any Strings already associated with the name, append to the array. This is used for handling parameters from mulitipart POST requests.


remove

public java.lang.Object remove(java.lang.String name)
Removes the named parameter from the contained hashtable. Wraps to the contained Hashtable.remove().


containsKey

public boolean containsKey(java.lang.Object key)
Determine whether a given key has been inserted. All keys are stored in lowercase strings, so override method to account for this.


keys

public java.util.Enumeration keys()

getKeys

public java.lang.Object[] getKeys()

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.


getBoolean

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


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.


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.


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.


getDouble

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


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.


getFloat

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


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 0.0.


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.


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.


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.


getInt

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


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.


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.


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.


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.


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.


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.


getLong

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


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.


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.


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.


getByte

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


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.


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.


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


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.


setString

public void setString(java.lang.String name,
                      java.lang.String value)
Set a parameter to a specific value.

This is useful if you want your action to override the values of the parameters for the screen to use.


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.


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.


setStrings

public void setStrings(java.lang.String name,
                       java.lang.String[] values)
Set a parameter to a specific value.

This is useful if you want your action to override the values of the parameters for the screen to use.


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.


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.


setProperties

public void setProperties(java.lang.Object bean)
                   throws java.lang.Exception
Uses bean introspection to set writable properties of bean from the parameters, where a (case-insensitive) name match between the bean property and the parameter is looked for.


toString

public java.lang.String toString()
Simple method that attempts to get a toString() representation of this object. It doesn't do well with String[]'s though.