|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.beanutils.converters.AbstractArrayConverter
Convenience base class for converters that translate the String representation of an array into a corresponding array of primitives object. This class encapsulates the functionality required to parse the String into a list of String elements that can later be individually converted to the appropriate primitive type.
The input syntax accepted by the parseElements()
method
is designed to be compatible with the syntax used to initialize arrays
in a Java source program, except that only String literal values are
supported. For maximum flexibility, the surrounding '{' and '}'
characters are optional, and individual elements may be separated by
any combination of whitespace and comma characters.
Field Summary | |
protected java.lang.Object |
defaultValue
The default value specified to our Constructor, if any. |
protected static java.lang.String[] |
strings
Model object for string arrays. |
protected boolean |
useDefault
Should we return the default value on conversion errors? |
Constructor Summary | |
AbstractArrayConverter()
|
Method Summary | |
abstract java.lang.Object |
convert(java.lang.Class type,
java.lang.Object value)
Convert the specified input object into an output object of the specified type. |
protected java.util.List |
parseElements(java.lang.String svalue)
Parse an incoming String of the form similar to an array initializer in the Java language into a List individual Strings
for each element, according to the following rules. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Object defaultValue
protected static java.lang.String[] strings
Model object for string arrays.
protected boolean useDefault
Constructor Detail |
public AbstractArrayConverter()
Method Detail |
public abstract java.lang.Object convert(java.lang.Class type, java.lang.Object value)
convert
in interface Converter
type
- Data type to which this value should be convertedvalue
- The input value to be converted
ConversionException
- if conversion cannot be performed
successfullyprotected java.util.List parseElements(java.lang.String svalue)
Parse an incoming String of the form similar to an array initializer
in the Java language into a List
individual Strings
for each element, according to the following rules.
svalue
- String value to be parsed
ConversionException
- if the syntax of svalue
is not syntactically valid
java.lang.NullPointerException
- if svalue
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |