|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.apache.turbine.util.pool.RecyclableSupport
|
+--org.apache.turbine.util.parser.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 java.util.Hashtable |
parameters
Random access storage for parameter data. |
| Fields inherited from interface org.apache.turbine.util.ValueParser |
URL_CASE_FOLDING, URL_CASE_FOLDING_LOWER, URL_CASE_FOLDING_NONE, URL_CASE_FOLDING_UPPER |
| Constructor Summary | |
BaseValueParser()
Default constructor |
|
BaseValueParser(java.lang.String characterEncoding)
Constructor that takes a character encoding |
|
| 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 |
containsDateSelectorKeys(java.lang.String key)
Check for existence of key_day, key_month and key_year parameters (as returned by DateSelector generated HTML). |
boolean |
containsKey(java.lang.Object key)
Determine whether a given key has been inserted. |
boolean |
containsTimeSelectorKeys(java.lang.String key)
Check for existence of key_hour, key_minute and key_second parameters (as returned by TimeSelector generated HTML). |
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. |
static java.lang.String |
convertAndTrim(java.lang.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. |
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. |
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()
|
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. |
org.apache.torque.om.NumberKey |
getNumberKey(java.lang.String name)
Return an NumberKey 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. |
org.apache.torque.om.StringKey |
getStringKey(java.lang.String name)
Return an StringKey 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()
|
void |
recycle()
Recycles the parser. |
void |
recycle(java.lang.String characterEncoding)
Recycles the parser with a character encoding. |
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. |
protected void |
setProperty(java.lang.Object bean,
java.beans.PropertyDescriptor prop)
Set the property 'prop' in the bean to the value of the corresponding parameters. |
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 textual representation of this object's name/value pairs. |
| Methods inherited from class org.apache.turbine.util.pool.RecyclableSupport |
doDispose, isDisposed, Recyclable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.turbine.util.pool.Recyclable |
isDisposed |
| Field Detail |
protected java.util.Hashtable parameters
| Constructor Detail |
public BaseValueParser()
public BaseValueParser(java.lang.String characterEncoding)
| Method Detail |
public static java.lang.String convertAndTrim(java.lang.String value)
value - A String to be processed.
public void recycle()
recycle in interface Recyclablerecycle in class RecyclableSupportpublic void recycle(java.lang.String characterEncoding)
characterEncoding - the character encoding.public void dispose()
dispose in interface Recyclabledispose in class RecyclableSupportpublic void clear()
clear in interface ValueParserpublic void setCharacterEncoding(java.lang.String s)
setCharacterEncoding in interface ValueParserpublic java.lang.String getCharacterEncoding()
getCharacterEncoding in interface ValueParser
public void add(java.lang.String name,
double value)
add in interface ValueParsername - A String with the name.value - A double with the value.
public void add(java.lang.String name,
int value)
add in interface ValueParsername - A String with the name.value - An int with the value.
public void add(java.lang.String name,
java.lang.Integer value)
add in interface ValueParsername - A String with the name.value - An Integer with the value.
public void add(java.lang.String name,
long value)
add in interface ValueParsername - A String with the name.value - A long with the value.
public void add(java.lang.String name,
java.lang.String value)
add in interface ValueParsername - A String with the name.value - A long with the value.
public void append(java.lang.String name,
java.lang.String value)
append in interface ValueParsername - A String with the name.value - A String with the value.public java.lang.Object remove(java.lang.String name)
Hashtable.remove().
remove in interface ValueParserString[])
or null if the key was not mapped.public java.lang.String convert(java.lang.String value)
convert in interface ValueParservalue - A String to be processed.
public boolean containsKey(java.lang.Object key)
containsKey in interface ValueParserkey - An Object with the key to search for.
public boolean containsDateSelectorKeys(java.lang.String key)
containsDateSelectorKeys in interface ValueParserkey - A String with the selector name.
public boolean containsTimeSelectorKeys(java.lang.String key)
key - A String with the selector name.
public java.util.Enumeration keys()
keys in interface ValueParserpublic java.lang.Object[] getKeys()
getKeys in interface ValueParser
public boolean getBoolean(java.lang.String name,
boolean defaultValue)
getBoolean in interface ValueParsername - A String with the name.defaultValue - The default value.
public boolean getBoolean(java.lang.String name)
getBoolean in interface ValueParsername - A String with the name.
public java.lang.Boolean getBool(java.lang.String name,
boolean defaultValue)
getBool in interface ValueParsername - A String with the name.defaultValue - The default value.
public java.lang.Boolean getBool(java.lang.String name)
getBool in interface ValueParsername - A String with the name.
public double getDouble(java.lang.String name,
double defaultValue)
getDouble in interface ValueParsername - A String with the name.defaultValue - The default value.
public double getDouble(java.lang.String name)
getDouble in interface ValueParsername - A String with the name.
public float getFloat(java.lang.String name,
float defaultValue)
getFloat in interface ValueParsername - A String with the name.defaultValue - The default value.
public float getFloat(java.lang.String name)
getFloat in interface ValueParsername - A String with the name.
public java.math.BigDecimal getBigDecimal(java.lang.String name,
java.math.BigDecimal defaultValue)
getBigDecimal in interface ValueParsername - A String with the name.defaultValue - The default value.
public java.math.BigDecimal getBigDecimal(java.lang.String name)
getBigDecimal in interface ValueParsername - A String with the name.
public java.math.BigDecimal[] getBigDecimals(java.lang.String name)
getBigDecimals in interface ValueParsername - A String with the name.
public int getInt(java.lang.String name,
int defaultValue)
getInt in interface ValueParsername - A String with the name.defaultValue - The default value.
public int getInt(java.lang.String name)
getInt in interface ValueParsername - A String with the name.
public java.lang.Integer getInteger(java.lang.String name,
int defaultValue)
getInteger in interface ValueParsername - A String with the name.defaultValue - The default value.
public java.lang.Integer getInteger(java.lang.String name,
java.lang.Integer def)
getInteger in interface ValueParsername - A String with the name.
public java.lang.Integer getInteger(java.lang.String name)
getInteger in interface ValueParsername - A String with the name.
public int[] getInts(java.lang.String name)
getInts in interface ValueParsername - A String with the name.
public java.lang.Integer[] getIntegers(java.lang.String name)
getIntegers in interface ValueParsername - A String with the name.
public long getLong(java.lang.String name,
long defaultValue)
getLong in interface ValueParsername - A String with the name.defaultValue - The default value.
public long getLong(java.lang.String name)
getLong in interface ValueParsername - A String with the name.
public long[] getLongs(java.lang.String name)
getLongs in interface ValueParsername - A String with the name.
public java.lang.Long[] getLongObjects(java.lang.String name)
getLongObjects in interface ValueParsername - A String with the name.
public byte getByte(java.lang.String name,
byte defaultValue)
getByte in interface ValueParsername - A String with the name.defaultValue - The default value.
public byte getByte(java.lang.String name)
getByte in interface ValueParsername - A String with the name.
public byte[] getBytes(java.lang.String name)
throws java.io.UnsupportedEncodingException
getBytes in interface ValueParsername - A String with the name.
UnsupportedEncodingException.
java.io.UnsupportedEncodingExceptionpublic java.lang.String getString(java.lang.String name)
getString in interface ValueParsername - A String with the name.
public java.lang.String get(java.lang.String name)
$data.Parameters.form_variable_name
get in interface ValueParsername - A String with the name.
public java.lang.String getString(java.lang.String name,
java.lang.String defaultValue)
getString in interface ValueParsername - A String with the name.defaultValue - The default value.
public void setString(java.lang.String name,
java.lang.String value)
setString in interface ValueParsername - The name of the parameter.value - The value to set.public java.lang.String[] getStrings(java.lang.String name)
getStrings in interface ValueParsername - A String with the name.
public java.lang.String[] getStrings(java.lang.String name,
java.lang.String[] defaultValue)
getStrings in interface ValueParsername - A String with the name.defaultValue - The default value.
public void setStrings(java.lang.String name,
java.lang.String[] values)
setStrings in interface ValueParsername - The name of the parameter.values - The value to set.public java.lang.Object getObject(java.lang.String name)
getObject in interface ValueParsername - A String with the name.
public java.lang.Object[] getObjects(java.lang.String name)
getObjects in interface ValueParsername - A String with the name.
public java.util.Date getDate(java.lang.String name,
java.text.DateFormat df,
java.util.Date defaultValue)
Date object. String is parsed by supplied
DateFormat. If the name does not exist, return the
defaultValue.
getDate in interface ValueParsername - A String with the name.df - A DateFormat.defaultValue - The default value.
public java.util.Date getDate(java.lang.String name)
Date object. If there are DateSelector or
TimeSelector style parameters then these are used. If not and there
is a parameter 'name' then this is parsed by DateFormat. If the
name does not exist, return null.
getDate in interface ValueParsername - A String with the name.
public java.util.Date getDate(java.lang.String name,
java.text.DateFormat df)
Date object. String is parsed by supplied
DateFormat. If the name does not exist, return null.
getDate in interface ValueParsername - A String with the name.df - A DateFormat.
public org.apache.torque.om.NumberKey getNumberKey(java.lang.String name)
getNumberKey in interface ValueParsername - A String with the name.
null if unparsable.public org.apache.torque.om.StringKey getStringKey(java.lang.String name)
getStringKey in interface ValueParsername - A String with the name.
null if unparsable.
public void setProperties(java.lang.Object bean)
throws java.lang.Exception
setProperties in interface ValueParserbean - An Object.
Exception, - a generic exception.
java.lang.Exceptionpublic java.lang.String toString()
toString in interface ValueParsertoString in class java.lang.Object
protected void setProperty(java.lang.Object bean,
java.beans.PropertyDescriptor prop)
throws java.lang.Exception
bean - An Object.prop - A PropertyDescriptor.
Exception, - a generic exception.
java.lang.Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||