com.puppycrawl.tools.checkstyle.api
final class StrArrayConverter extends 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, "_" :(Constructor Summary | |
---|---|
StrArrayConverter()
Creates a new StrArrayConverter object. | |
StrArrayConverter(Object aDefaultValue)
Create a onverter that will return the specified default value
if a conversion error occurs.
|
Method Summary | |
---|---|
Object | convert(Class aType, Object aValue)
Convert the specified input object into an output object of the
specified type.
|
protected List | parseElements(String aValue)
Parse an incoming String of the form similar to an array initializer in
the Java language into a |
Parameters: aDefaultValue The default value to be returned
Parameters: aType Data type to which this value should be converted aValue The input value to be converted
Returns: the converted object
Throws: ConversionException if conversion cannot be performed successfully
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.
Parameters: aValue String value to be parsed
Returns: the list of Strings parsed from the array
Throws: NullPointerException
if svalue
is null