public interface ValueParser extends Iterable<String>
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:
Modifier and Type | Interface and Description |
---|---|
static class |
ValueParser.URLCaseFolding
Possible values for the URL folding setting
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CHARACTER_ENCODING
The default character encoding to use when converting to byte arrays
|
Modifier and Type | Method and Description |
---|---|
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 |
add(String name,
String[] value)
Add an array of Strings for a key.
|
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.
|
String |
convertAndTrim(String value)
Convert a String value according to the url-case-folding property.
|
String |
convertAndTrim(String value,
ValueParser.URLCaseFolding folding)
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()
Dispose all references of this object.
|
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 |
getBoolean(String name)
Return a boolean for the given name.
|
boolean |
getBoolean(String name,
boolean defaultValue)
Return a boolean for the given name.
|
Boolean |
getBooleanObject(String name)
Returns a Boolean object for the given name.
|
Boolean |
getBooleanObject(String name,
Boolean defaultValue)
Returns a Boolean object for the given name.
|
Boolean[] |
getBooleanObjects(String name)
Return an array of Booleans for the given name.
|
boolean[] |
getBooleans(String name)
Return an array of booleans 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 |
getByteObject(String name)
Return a byte for the given name.
|
Byte |
getByteObject(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.
|
Date |
getDate(String name)
Returns a java.util.Date object.
|
Date |
getDate(String name,
DateFormat df)
Returns a java.util.Date object.
|
Date |
getDate(String name,
DateFormat df,
Date defaultValue)
Returns a java.util.Date object.
|
DateFormat |
getDateFormat()
Get the date format 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.
|
Double |
getDoubleObject(String name)
Return a Double for the given name.
|
Double |
getDoubleObject(String name,
Double defaultValue)
Return a Double for the given name.
|
Double[] |
getDoubleObjects(String name)
Return an array of doubles for the given name.
|
double[] |
getDoubles(String name)
Return an array of doubles 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.
|
Float |
getFloatObject(String name)
Return a float for the given name.
|
Float |
getFloatObject(String name,
Float defaultValue)
Return a Float for the given name.
|
Float[] |
getFloatObjects(String name)
Return an array of floats for the given name.
|
float[] |
getFloats(String name)
Return an array of floats 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 |
getIntObject(String name)
Return an Integer for the given name.
|
Integer |
getIntObject(String name,
Integer defaultValue)
Return an Integer for the given name.
|
Integer[] |
getIntObjects(String name)
Return an array of Integers for the given name.
|
int[] |
getInts(String name)
Return an array of ints for the given name.
|
String[] |
getKeys()
Returns all the available parameter names.
|
Locale |
getLocale()
Get the locale that will be used by this ValueParser.
|
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 |
getLongObject(String name)
Return a Long for the given name.
|
Long |
getLongObject(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.
|
NumberFormat |
getNumberFormat()
Get the number format that will be used by this ValueParser.
|
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.
|
ValueParser.URLCaseFolding |
getUrlFolding()
Gets the folding value from the ParserService configuration
|
Set<String> |
keySet()
Gets the keys.
|
Object |
remove(String name)
Removes the named parameter from the contained hashtable.
|
void |
setCharacterEncoding(String characterEncoding)
Set the character encoding that will be used by this ValueParser.
|
void |
setDateFormat(DateFormat dateFormat)
Set the date format that will be used by this ValueParser.
|
void |
setLocale(Locale locale)
Set the locale that will be used by this ValueParser.
|
void |
setNumberFormat(NumberFormat numberFormat)
Set the number format 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.
|
forEach, iterator, spliterator
static final String DEFAULT_CHARACTER_ENCODING
void clear()
void dispose()
void setCharacterEncoding(String characterEncoding)
characterEncoding
- the character encoding to useString getCharacterEncoding()
void setLocale(Locale locale)
locale
- the default locale to be used by the parserLocale getLocale()
void setDateFormat(DateFormat dateFormat)
dateFormat
- the date formatDateFormat getDateFormat()
void setNumberFormat(NumberFormat numberFormat)
numberFormat
- the number format to useNumberFormat getNumberFormat()
String convert(String value)
value
- A String to be processed.void add(String name, double value)
name
- A String with the name.value
- A double with the value.void add(String name, int value)
name
- A String with the name.value
- An int with the value.void add(String name, Integer value)
name
- A String with the name.value
- An Integer with the value.void add(String name, long value)
name
- A String with the name.value
- A long with the value.void add(String name, String value)
name
- A String with the name.value
- A long with the value.void add(String name, String[] value)
name
- A String with the name.value
- A String Array.Object remove(String name)
Hashtable.remove()
.name
- the name of the mapped value to removeString[]
)
or null
if the key was not mapped.boolean containsKey(Object key)
key
- An Object with the key to search for.String[] getKeys()
boolean getBoolean(String name, boolean defaultValue)
name
- A String with the name.defaultValue
- The default value.boolean getBoolean(String name)
name
- A String with the name.Boolean getBooleanObject(String name)
Valid values for true: true, on, 1, yes
Valid values for false: false, off, 0, no
The string is compared without reguard to case.
name
- A String with the name.Boolean getBooleanObject(String name, Boolean defaultValue)
Valid values for true: true, on, 1, yes
Valid values for false: false, off, 0, no
The string is compared without regard to case.
name
- A String with the name.defaultValue
- boolean default if not foundboolean[] getBooleans(String name)
name
- A String with the name.Boolean[] getBooleanObjects(String name)
name
- A String with the name.double getDouble(String name, double defaultValue)
name
- A String with the name.defaultValue
- The default value.double getDouble(String name)
name
- A String with the name.double[] getDoubles(String name)
name
- A String with the name.Double getDoubleObject(String name, Double defaultValue)
name
- A String with the name.defaultValue
- The default value.Double getDoubleObject(String name)
name
- A String with the name.Double[] getDoubleObjects(String name)
name
- A String with the name.float getFloat(String name, float defaultValue)
name
- A String with the name.defaultValue
- The default value.float getFloat(String name)
name
- A String with the name.float[] getFloats(String name)
name
- A String with the name.Float getFloatObject(String name, Float defaultValue)
name
- A String with the name.defaultValue
- The default value.Float getFloatObject(String name)
name
- A String with the name.Float[] getFloatObjects(String name)
name
- A String with the name.BigDecimal getBigDecimal(String name, BigDecimal defaultValue)
name
- A String with the name.defaultValue
- The default value.BigDecimal getBigDecimal(String name)
null
.name
- A String with the name.BigDecimal[] getBigDecimals(String name)
name
- A String with the name.int getInt(String name, int defaultValue)
name
- A String with the name.defaultValue
- The default value.int getInt(String name)
name
- A String with the name.Integer getIntObject(String name, Integer defaultValue)
name
- A String with the name.defaultValue
- The default value.Integer getIntObject(String name)
name
- A String with the name.int[] getInts(String name)
name
- A String with the name.Integer[] getIntObjects(String name)
name
- A String with the name.long getLong(String name, long defaultValue)
name
- A String with the name.defaultValue
- The default value.long getLong(String name)
name
- A String with the name.Long getLongObject(String name, Long defaultValue)
name
- A String with the name.defaultValue
- The default value.Long getLongObject(String name)
name
- A String with the name.long[] getLongs(String name)
name
- A String with the name.Long[] getLongObjects(String name)
name
- A String with the name.byte getByte(String name, byte defaultValue)
name
- A String with the name.defaultValue
- The default value.byte getByte(String name)
name
- A String with the name.byte[] getBytes(String name) throws UnsupportedEncodingException
name
- A String with the name.UnsupportedEncodingException
- Generic exceptionByte getByteObject(String name, Byte defaultValue)
name
- A String with the name.defaultValue
- The default value.Byte getByteObject(String name)
name
- A String with the name.String getString(String name)
name
- A String with the name.String get(String name)
$data.Parameters.form_variable_name
name
- A String with the name.String getString(String name, String defaultValue)
name
- A String with the name.defaultValue
- The default value.void setString(String name, String value)
name
- The name of the parameter.value
- The value to set.String[] getStrings(String name)
name
- A String with the name.String[] getStrings(String name, String[] defaultValue)
name
- A String with the name.defaultValue
- The default value.void setStrings(String name, String[] values)
name
- The name of the parameter.values
- The value to set.Object getObject(String name)
name
- A String with the name.Object[] getObjects(String name)
name
- A String with the name.Date getDate(String name, DateFormat df, Date defaultValue)
name
- A String with the name.df
- A DateFormat.defaultValue
- The default value.Date getDate(String name)
name
- A String with the name.Date getDate(String name, DateFormat df)
name
- A String with the name.df
- A DateFormat.void setProperties(Object bean) throws Exception
bean
- An Object.Exception
- a generic exception.String toString()
String convertAndTrim(String value)
value
- the String to convertString convertAndTrim(String value, ValueParser.URLCaseFolding folding)
value
- A String to be processed.folding
- the type of URL case folding to be usedValueParser.URLCaseFolding getUrlFolding()
Copyright © 2005–2019 The Apache Software Foundation. All rights reserved.