public class ParseBool extends CellProcessorAdaptor implements StringCellProcessor
The default values for true are: "true", "1", "y", "t"
The default values for false are: "false", "0", "n", "f"
The input is converted to lowercase before comparison against the true/false values (to handle all variations of case in the input), so if you supply your own true/false values then ensure they are lowercase.
next
Constructor and Description |
---|
ParseBool()
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values.
|
ParseBool(BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values,
then calls the next processor in the chain.
|
ParseBool(String[] trueValues,
String[] falseValues)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values.
|
ParseBool(String[] trueValues,
String[] falseValues,
BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values, then calls the next processor in the chain.
|
ParseBool(String trueValue,
String falseValue)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values.
|
ParseBool(String trueValue,
String falseValue,
BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values, then calls the next processor in the chain.
|
Modifier and Type | Method and Description |
---|---|
Object |
execute(Object value,
CsvContext context)
This method is invoked by the framework when the processor needs to process data or check constraints.
|
toString, validateInputNotNull
public ParseBool()
public ParseBool(BoolCellProcessor next)
next
- the next processor in the chainNullPointerException
- if next is nullpublic ParseBool(String trueValue, String falseValue)
trueValue
- the String which represents truefalseValue
- the String which represents falseNullPointerException
- if trueValue or falseValue is nullpublic ParseBool(String[] trueValues, String[] falseValues)
trueValues
- the array of Strings which represent truefalseValues
- the array of Strings which represent falseIllegalArgumentException
- if trueValues or falseValues is emptyNullPointerException
- if trueValues or falseValues is nullpublic ParseBool(String trueValue, String falseValue, BoolCellProcessor next)
trueValue
- the String which represents truefalseValue
- the String which represents falsenext
- the next processor in the chainNullPointerException
- if trueValue, falseValue or next is nullpublic ParseBool(String[] trueValues, String[] falseValues, BoolCellProcessor next)
trueValues
- the array of Strings which represent truefalseValues
- the array of Strings which represent falsenext
- the next processor in the chainIllegalArgumentException
- if trueValues or falseValues is emptyNullPointerException
- if trueValues, falseValues, or next is nullpublic Object execute(Object value, CsvContext context)
execute
in interface CellProcessor
SuperCsvCellProcessorException
- if value is null, not a String, or can't be parsed to a BooleanCopyright © 2007-2012 Super CSV. All Rights Reserved.