|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.misc.upload.BaseValueParser
BaseValueParser is a base class for classes that need to parse name/value Parameters, for example GET/POST data or Cookies (DefaultParameterParser and DefaultCookieParser)
It can also be used standalone, for an example see DataStreamParser.
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:
ValueParser vp = new BaseValueParser();
vp.add("ERROR",1);
vp.add("eRrOr",2);
int result = vp.getInt("ERROR");
In the above example, result is 2.
| Field Summary | |
protected Hashtable |
parameters
Random access storage for parameter data. |
| Fields inherited from interface com.jcorporate.expresso.core.misc.upload.ValueParser |
URL_CASE_FOLDING, URL_CASE_FOLDING_LOWER, URL_CASE_FOLDING_NONE, URL_CASE_FOLDING_UPPER |
| Constructor Summary | |
BaseValueParser()
Default constructor |
|
BaseValueParser(String newEncoding)
Constructor that takes a character encoding |
|
| Method Summary | |
void |
add(String name,
double value)
Add a name/value pair into this object. |
void |
add(String name,
int value)
Add a name/value pair into this object. |
void |
add(String name,
Integer value)
Add a name/value pair into this object. |
void |
add(String name,
long value)
Add a name/value pair into this object. |
void |
add(String name,
String value)
Add a name/value pair into this object. |
void |
append(String name,
String value)
Add a String parameters. |
void |
clear()
Clear all name/value pairs out of this object. |
boolean |
containsKey(Object key)
Determine whether a given key has been inserted. |
String |
convert(String value)
Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. |
static String |
convertAndTrim(String value)
A static version of the convert method, which trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. |
void |
dispose()
Disposes the parser. |
String |
get(String name)
Return a String for the given name. |
BigDecimal |
getBigDecimal(String name)
Return a BigDecimal for the given name. |
BigDecimal |
getBigDecimal(String name,
BigDecimal defaultValue)
Return a BigDecimal for the given name. |
BigDecimal[] |
getBigDecimals(String name)
Return an array of BigDecimals for the given name. |
Boolean |
getBool(String name)
Return a Boolean for the given name. |
Boolean |
getBool(String name,
boolean defaultValue)
Return a Boolean for the given name. |
boolean |
getBoolean(String name)
Return a boolean for the given name. |
boolean |
getBoolean(String name,
boolean defaultValue)
Return a boolean for the given name. |
byte |
getByte(String name)
Return a byte for the given name. |
byte |
getByte(String name,
byte defaultValue)
Return a byte for the given name. |
byte[] |
getBytes(String name)
Return an array of bytes for the given name. |
String |
getCharacterEncoding()
Get the character encoding that will be used by this ValueParser. |
double |
getDouble(String name)
Return a double for the given name. |
double |
getDouble(String name,
double defaultValue)
Return a double for the given name. |
float |
getFloat(String name)
Return a float for the given name. |
float |
getFloat(String name,
float defaultValue)
Return a float for the given name. |
int |
getInt(String name)
Return an int for the given name. |
int |
getInt(String name,
int defaultValue)
Return an int for the given name. |
Integer |
getInteger(String name)
Return an Integer for the given name. |
Integer |
getInteger(String name,
int defaultValue)
Return an Integer for the given name. |
Integer |
getInteger(String name,
Integer def)
Return an Integer for the given name. |
Integer[] |
getIntegers(String name)
Return an array of Integers for the given name. |
int[] |
getInts(String name)
Return an array of ints for the given name. |
Object[] |
getKeys()
|
long |
getLong(String name)
Return a long for the given name. |
long |
getLong(String name,
long defaultValue)
Return a long for the given name. |
Long[] |
getLongObjects(String name)
Return an array of Longs for the given name. |
long[] |
getLongs(String name)
Return an array of longs for the given name. |
Object |
getObject(String name)
Return an Object for the given name. |
Object[] |
getObjects(String name)
Return an array of Objects for the given name. |
String |
getString(String name)
Return a String for the given name. |
String |
getString(String name,
String defaultValue)
Return a String for the given name. |
String[] |
getStrings(String name)
Return an array of Strings for the given name. |
String[] |
getStrings(String name,
String[] defaultValue)
Return an array of Strings for the given name. |
Enumeration |
keys()
|
Object |
remove(String name)
Removes the named parameter from the contained hashtable. |
void |
setCharacterEncoding(String s)
Set the character encoding that will be used by this ValueParser. |
void |
setProperties(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(String name,
String value)
Set a parameter to a specific value. |
void |
setStrings(String name,
String[] values)
Set a parameter to a specific value. |
String |
toString()
Simple method that attempts to get a toString() representation of this object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Hashtable parameters
| Constructor Detail |
public BaseValueParser()
public BaseValueParser(String newEncoding)
| Method Detail |
public static String convertAndTrim(String value)
value - A String to be processed.
public void dispose()
public void clear()
clear in interface ValueParserpublic void setCharacterEncoding(String s)
setCharacterEncoding in interface ValueParserpublic String getCharacterEncoding()
getCharacterEncoding in interface ValueParser
public void add(String name,
double value)
add in interface ValueParsername - A String with the name.value - A double with the value.
public void add(String name,
int value)
add in interface ValueParsername - A String with the name.value - An int with the value.
public void add(String name,
Integer value)
add in interface ValueParsername - A String with the name.value - An Integer with the value.
public void add(String name,
long value)
add in interface ValueParsername - A String with the name.value - A long with the value.
public void add(String name,
String value)
add in interface ValueParsername - A String with the name.value - A long with the value.
public void append(String name,
String value)
append in interface ValueParsername - A String with the name.value - A String with the value.public Object remove(String name)
Hashtable.remove().
remove in interface ValueParserString[])
or null if the key was not mapped.public String convert(String value)
convert in interface ValueParservalue - A String to be processed.
public boolean containsKey(Object key)
containsKey in interface ValueParserkey - An Object with the key to search for.
public Enumeration keys()
keys in interface ValueParserpublic Object[] getKeys()
getKeys in interface ValueParser
public boolean getBoolean(String name,
boolean defaultValue)
getBoolean in interface ValueParsername - A String with the name.defaultValue - The default value.
public boolean getBoolean(String name)
getBoolean in interface ValueParsername - A String with the name.
public Boolean getBool(String name,
boolean defaultValue)
getBool in interface ValueParsername - A String with the name.defaultValue - The default value.
public Boolean getBool(String name)
getBool in interface ValueParsername - A String with the name.
public double getDouble(String name,
double defaultValue)
getDouble in interface ValueParsername - A String with the name.defaultValue - The default value.
public double getDouble(String name)
getDouble in interface ValueParsername - A String with the name.
public float getFloat(String name,
float defaultValue)
getFloat in interface ValueParsername - A String with the name.defaultValue - The default value.
public float getFloat(String name)
getFloat in interface ValueParsername - A String with the name.
public BigDecimal getBigDecimal(String name,
BigDecimal defaultValue)
getBigDecimal in interface ValueParsername - A String with the name.defaultValue - The default value.
public BigDecimal getBigDecimal(String name)
getBigDecimal in interface ValueParsername - A String with the name.
public BigDecimal[] getBigDecimals(String name)
getBigDecimals in interface ValueParsername - A String with the name.
public int getInt(String name,
int defaultValue)
getInt in interface ValueParsername - A String with the name.defaultValue - The default value.
public int getInt(String name)
getInt in interface ValueParsername - A String with the name.
public Integer getInteger(String name,
int defaultValue)
getInteger in interface ValueParsername - A String with the name.defaultValue - The default value.
public Integer getInteger(String name,
Integer def)
getInteger in interface ValueParsername - A String with the name.
public Integer getInteger(String name)
getInteger in interface ValueParsername - A String with the name.
public int[] getInts(String name)
getInts in interface ValueParsername - A String with the name.
public Integer[] getIntegers(String name)
getIntegers in interface ValueParsername - A String with the name.
public long getLong(String name,
long defaultValue)
getLong in interface ValueParsername - A String with the name.defaultValue - The default value.
public long getLong(String name)
getLong in interface ValueParsername - A String with the name.
public long[] getLongs(String name)
getLongs in interface ValueParsername - A String with the name.
public Long[] getLongObjects(String name)
getLongObjects in interface ValueParsername - A String with the name.
public byte getByte(String name,
byte defaultValue)
getByte in interface ValueParsername - A String with the name.defaultValue - The default value.
public byte getByte(String name)
getByte in interface ValueParsername - A String with the name.
public byte[] getBytes(String name)
throws UnsupportedEncodingException
getBytes in interface ValueParsername - A String with the name.
UnsupportedEncodingExceptionpublic String getString(String name)
getString in interface ValueParsername - A String with the name.
public String get(String name)
$data.Parameters.form_variable_name
get in interface ValueParsername - A String with the name.
public String getString(String name,
String defaultValue)
getString in interface ValueParsername - A String with the name.defaultValue - The default value.
public void setString(String name,
String value)
setString in interface ValueParsername - The name of the parameter.value - The value to set.public String[] getStrings(String name)
getStrings in interface ValueParsername - A String with the name.
public String[] getStrings(String name,
String[] defaultValue)
getStrings in interface ValueParsername - A String with the name.defaultValue - The default value.
public void setStrings(String name,
String[] values)
setStrings in interface ValueParsername - The name of the parameter.values - The value to set.public Object getObject(String name)
getObject in interface ValueParsername - A String with the name.
public Object[] getObjects(String name)
getObjects in interface ValueParsername - A String with the name.
public void setProperties(Object bean)
throws Exception
setProperties in interface ValueParserbean - An Object.
Exception, - a generic exception.
Exceptionpublic String toString()
toString in interface ValueParser
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||