Package org.apache.fulcrum.parser
Schnittstelle ValueParser
- Alle bekannten Unterschnittstellen:
CookieParser
,ParameterParser
- Alle bekannten Implementierungsklassen:
BaseValueParser
,DefaultCookieParser
,DefaultParameterParser
,StringValueParser
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$
- Autor:
- Ilkka Priha, Jon S. Stevens, Sean Legassick, Jason van Zyl, Jürgen Hoffmann, Thomas Vandahl
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypSchnittstelleBeschreibungstatic enum
Possible values for the URL folding setting -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
The default character encoding to use when converting to byte arrays -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Add a name/value pair into this object.void
Add a name/value pair into this object.void
Add a name/value pair into this object.void
Add a name/value pair into this object.void
Add a name/value pair into this object.void
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.Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING.convertAndTrim
(String value) Convert a String value according to the url-case-folding property.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.Return a String for the given name.getBigDecimal
(String name) Return a BigDecimal for the given name.getBigDecimal
(String name, BigDecimal defaultValue) Return a BigDecimal for the given name.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.getBooleanObject
(String name) Returns a Boolean object for the given name.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
Return a byte for the given name.byte
Return a byte for the given name.getByteObject
(String name) Return a byte for the given name.getByteObject
(String name, Byte defaultValue) Return a byte for the given name.byte[]
Return an array of bytes for the given name.Get the character encoding that will be used by this ValueParser.Returns a java.util.Date object.getDate
(String name, DateFormat df) Returns a java.util.Date object.getDate
(String name, DateFormat df, Date defaultValue) Returns a java.util.Date object.Get the date format that will be used by this ValueParser.double
Return a double for the given name.double
Return a double for the given name.getDoubleObject
(String name) Return a Double for the given name.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
Return a float for the given name.float
Return a float for the given name.getFloatObject
(String name) Return a float for the given name.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[]
Return an array of floats for the given name.int
Return an int for the given name.int
Return an int for the given name.getIntObject
(String name) Return an Integer for the given name.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[]
Return an array of ints for the given name.String[]
getKeys()
Returns all the available parameter names.Get the locale that will be used by this ValueParser.long
Return a long for the given name.long
Return a long for the given name.getLongObject
(String name) Return a Long for the given name.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[]
Return an array of longs for the given name.Get the number format that will be used by this ValueParser.Return an Object for the given name.Object[]
getObjects
(String name) Return an array of Objects for the given name.Return a String for the given name.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.Gets the folding value from the ParserService configurationkeySet()
Gets the keys.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
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
Set a parameter to a specific value.void
setStrings
(String name, String[] values) Set a parameter to a specific value.toString()
Simple method that attempts to get a toString() representation of this object.Von Schnittstelle geerbte Methoden java.lang.Iterable
forEach, iterator, spliterator
-
Felddetails
-
DEFAULT_CHARACTER_ENCODING
The default character encoding to use when converting to byte arrays- Siehe auch:
-
-
Methodendetails
-
clear
void clear()Clear all name/value pairs out of this object. -
dispose
void dispose()Dispose all references of this object. Instead of org.apache.fulcrum.pool.Recyclable interface we use this, may change this again.. -
setCharacterEncoding
Set the character encoding that will be used by this ValueParser.- Parameter:
characterEncoding
- the character encoding to use
-
getCharacterEncoding
String getCharacterEncoding()Get the character encoding that will be used by this ValueParser.- Gibt zurück:
- Current character encoding
-
setLocale
Set the locale that will be used by this ValueParser.- Parameter:
locale
- the default locale to be used by the parser
-
getLocale
Locale getLocale()Get the locale that will be used by this ValueParser.- Gibt zurück:
- Locale the locale being used
-
setDateFormat
Set the date format that will be used by this ValueParser.- Parameter:
dateFormat
- the date format
-
getDateFormat
DateFormat getDateFormat()Get the date format that will be used by this ValueParser.- Gibt zurück:
- DateFormat current date format used by this ValueParser
-
setNumberFormat
Set the number format that will be used by this ValueParser.- Parameter:
numberFormat
- the number format to use
-
getNumberFormat
NumberFormat getNumberFormat()Get the number format that will be used by this ValueParser.- Gibt zurück:
- NumberFormat the current number format
-
convert
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.- Parameter:
value
- A String to be processed.- Gibt zurück:
- A new String converted to lowercase and trimmed.
-
add
Add a name/value pair into this object.- Parameter:
name
- A String with the name.value
- A double with the value.
-
add
Add a name/value pair into this object.- Parameter:
name
- A String with the name.value
- An int with the value.
-
add
Add a name/value pair into this object.- Parameter:
name
- A String with the name.value
- An Integer with the value.
-
add
Add a name/value pair into this object.- Parameter:
name
- A String with the name.value
- A long with the value.
-
add
Add a name/value pair into this object.- Parameter:
name
- A String with the name.value
- A long with the value.
-
add
Add an array of Strings for a key. This is simply adding all the elements in the array one by one.- Parameter:
name
- A String with the name.value
- A String Array.
-
remove
Removes the named parameter from the contained hashtable. Wraps to the containedHashtable.remove()
.- Parameter:
name
- the name of the mapped value to remove- Gibt zurück:
- The value that was mapped to the key (a
String[]
) ornull
if the key was not mapped.
-
containsKey
Determine whether a given key has been inserted. All keys are stored in lowercase strings, so override method to account for this.- Parameter:
key
- An Object with the key to search for.- Gibt zurück:
- True if the object is found.
-
keySet
Gets the keys.- Gibt zurück:
- A
Set
of the keys.
-
getKeys
String[] getKeys()Returns all the available parameter names.- Gibt zurück:
- A object array with the keys.
-
getBoolean
Return a boolean for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A boolean.
-
getBoolean
Return a boolean for the given name. If the name does not exist, return false.- Parameter:
name
- A String with the name.- Gibt zurück:
- A boolean.
-
getBooleanObject
Returns a Boolean object for the given name. If the parameter does not exist or can not be parsed as a boolean, null is returned.Valid values for true: true, on, 1, yes
Valid values for false: false, off, 0, no
The string is compared without reguard to case.
- Parameter:
name
- A String with the name.- Gibt zurück:
- A Boolean.
-
getBooleanObject
Returns a Boolean object for the given name. If the parameter does not exist or can not be parsed as a boolean, the defaultValue is returned.Valid values for true: true, on, 1, yes
Valid values for false: false, off, 0, no
The string is compared without regard to case.
- Parameter:
name
- A String with the name.defaultValue
- boolean default if not found- Gibt zurück:
- A Boolean.
-
getBooleans
Return an array of booleans for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A boolean[].
-
getBooleanObjects
Return an array of Booleans for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A Boolean[].
-
getDouble
Return a double for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A double.
-
getDouble
Return a double for the given name. If the name does not exist, return 0.0.- Parameter:
name
- A String with the name.- Gibt zurück:
- A double.
-
getDoubles
Return an array of doubles for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A double[].
-
getDoubleObject
Return a Double for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A double.
-
getDoubleObject
Return a Double for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A double.
-
getDoubleObjects
Return an array of doubles for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A double[].
-
getFloat
Return a float for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A float.
-
getFloat
Return a float for the given name. If the name does not exist, return 0.0.- Parameter:
name
- A String with the name.- Gibt zurück:
- A float.
-
getFloats
Return an array of floats for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A float[].
-
getFloatObject
Return a Float for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A Float.
-
getFloatObject
Return a float for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A Float.
-
getFloatObjects
Return an array of floats for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A float[].
-
getBigDecimal
Return a BigDecimal for the given name. If the name does not exist, return 0.0.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A BigDecimal.
-
getBigDecimal
Return a BigDecimal for the given name. If the name does not exist, returnnull
.- Parameter:
name
- A String with the name.- Gibt zurück:
- A BigDecimal.
-
getBigDecimals
Return an array of BigDecimals for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A BigDecimal[].
-
getInt
Return an int for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- An int.
-
getInt
Return an int for the given name. If the name does not exist, return 0.- Parameter:
name
- A String with the name.- Gibt zurück:
- An int.
-
getIntObject
Return an Integer for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- An Integer.
-
getIntObject
Return an Integer for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- An Integer.
-
getInts
Return an array of ints for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- An int[].
-
getIntObjects
Return an array of Integers for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- An Integer[].
-
getLong
Return a long for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A long.
-
getLong
Return a long for the given name. If the name does not exist, return 0.- Parameter:
name
- A String with the name.- Gibt zurück:
- A long.
-
getLongObject
Return a Long for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A Long.
-
getLongObject
Return a Long for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A Long.
-
getLongs
Return an array of longs for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A long[].
-
getLongObjects
Return an array of Longs for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A Long[].
-
getByte
Return a byte for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A byte.
-
getByte
Return a byte for the given name. If the name does not exist, return 0.- Parameter:
name
- A String with the name.- Gibt zurück:
- A byte.
-
getBytes
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.- Parameter:
name
- A String with the name.- Gibt zurück:
- A byte[].
- Löst aus:
UnsupportedEncodingException
- Generic exception
-
getByteObject
Return a byte for the given name. If the name does not exist, return defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A byte.
-
getByteObject
Return a byte for the given name. If the name does not exist, return 0.- Parameter:
name
- A String with the name.- Gibt zurück:
- A byte.
-
getString
Return a String for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A String.
-
get
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
- Parameter:
name
- A String with the name.- Gibt zurück:
- A String.
-
getString
Return a String for the given name. If the name does not exist, return the defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A String.
-
setString
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.- Parameter:
name
- The name of the parameter.value
- The value to set.
-
getStrings
Return an array of Strings for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- A String[].
-
getStrings
Return an array of Strings for the given name. If the name does not exist, return the defaultValue.- Parameter:
name
- A String with the name.defaultValue
- The default value.- Gibt zurück:
- A String[].
-
setStrings
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.- Parameter:
name
- The name of the parameter.values
- The value to set.
-
getObject
Return an Object for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- An Object.
-
getObjects
Return an array of Objects for the given name. If the name does not exist, return null.- Parameter:
name
- A String with the name.- Gibt zurück:
- An Object[].
-
getDate
Returns a java.util.Date object. String is parsed by supplied DateFormat. If the name does not exist, return the defaultValue.- Parameter:
name
- A String with the name.df
- A DateFormat.defaultValue
- The default value.- Gibt zurück:
- A Date.
-
getDate
Returns a java.util.Date object. If there are DateSelector 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.- Parameter:
name
- A String with the name.- Gibt zurück:
- A Date.
-
getDate
Returns a java.util.Date object. String is parsed by supplied DateFormat. If the name does not exist, return null.- Parameter:
name
- A String with the name.df
- A DateFormat.- Gibt zurück:
- A Date.
-
setProperties
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.- Parameter:
bean
- An Object.- Löst aus:
Exception
- a generic exception.
-
toString
String toString()Simple method that attempts to get a toString() representation of this object. It doesn't do well with String[]'s though. -
convertAndTrim
Convert a String value according to the url-case-folding property.- Parameter:
value
- the String to convert- Gibt zurück:
- a new String.
-
convertAndTrim
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. It returns a new string so that it does not destroy the value data.- Parameter:
value
- A String to be processed.folding
- the type of URL case folding to be used- Gibt zurück:
- A new String converted and trimmed.
-
getUrlFolding
ValueParser.URLCaseFolding getUrlFolding()Gets the folding value from the ParserService configuration- Gibt zurück:
- The current Folding Value
-