java.lang.Object
org.apache.commons.beanutils.converters.AbstractArrayConverter
com.puppycrawl.tools.checkstyle.api.StrArrayConverter
- All Implemented Interfaces:
- org.apache.commons.beanutils.Converter
- final class StrArrayConverter
- extends org.apache.commons.beanutils.converters.AbstractArrayConverter
Standard Converter implementation that converts an incoming
String into an array of String. On a conversion failure, returns
a specified default value or throws a ConversionException depending
on how this instance is constructed.
Hacked from
http://cvs.apache.org/viewcvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/converters/StringArrayConverter.java
because that implementation fails to convert array of tokens with elements
containing an underscore, "_" :(
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
sModel
private static java.lang.String[] sModel
Model object for type comparisons.
StrArrayConverter
public StrArrayConverter()
- Creates a new StrArrayConverter object.
StrArrayConverter
public StrArrayConverter(java.lang.Object aDefaultValue)
- Create a onverter that will return the specified default value
if a conversion error occurs.
convert
public java.lang.Object convert(java.lang.Class aType,
java.lang.Object aValue)
throws org.apache.commons.beanutils.ConversionException
- Convert the specified input object into an output object of the
specified type.
parseElements
protected java.util.List parseElements(java.lang.String aValue)
throws java.lang.NullPointerException
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.
- The string must have matching '{' and '}' delimiters around
a comma-delimited list of values.
- Whitespace before and after each element is stripped.
- If an element is itself delimited by matching single or double
quotes, the usual rules for interpreting a quoted String apply.