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"
By default (unless the ignoreCase parameter is supplied on the constructor) this processor will ignore the case of the value, i.e. "true", "TRUE", and "True" will all be converted to true (likewise for false).
Prior to version 2.2.1, this processor always ignored case, so it was necessary to ensure that all supplied true/false values were lowercase, as the input was converted to lowercase before comparison against the true/false values (to handle all variations of case in the input). This is no longer required (just use the ignoreCase parameter).
next
Constructor and Description |
---|
ParseBool()
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values
(ignoring case).
|
ParseBool(BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values
(ignoring case), then calls the next processor in the chain.
|
ParseBool(boolean ignoreCase)
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values
(ignoring case if desired).
|
ParseBool(boolean ignoreCase,
BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the default values
(ignoring case if desired), 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 (ignoring case).
|
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 (ignoring case), then calls the next processor in the chain.
|
ParseBool(String[] trueValues,
String[] falseValues,
boolean ignoreCase)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values (ignoring case if desired).
|
ParseBool(String[] trueValues,
String[] falseValues,
boolean ignoreCase,
BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values (ignoring case if desired), 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 (ignoring case).
|
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 (ignoring case), then calls the next processor in the chain.
|
ParseBool(String trueValue,
String falseValue,
boolean ignoreCase)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values (ignoring case if desired).
|
ParseBool(String trueValue,
String falseValue,
boolean ignoreCase,
BoolCellProcessor next)
Constructs a new ParseBool processor, which converts a String to a Boolean using the supplied true/false
values (ignoring case if desired), 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(boolean ignoreCase)
ignoreCase
- whether to ignore the case when comparing against the true/false valuespublic ParseBool(BoolCellProcessor next)
next
- the next processor in the chainNullPointerException
- if next is nullpublic ParseBool(boolean ignoreCase, BoolCellProcessor next)
ignoreCase
- whether to ignore the case when comparing against the true/false valuesnext
- 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 trueValue, String falseValue, boolean ignoreCase)
trueValue
- the String which represents truefalseValue
- the String which represents falseignoreCase
- whether to ignore the case when comparing against the true/false valuesNullPointerException
- 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[] trueValues, String[] falseValues, boolean ignoreCase)
trueValues
- the array of Strings which represent truefalseValues
- the array of Strings which represent falseignoreCase
- whether to ignore the case when comparing against the true/false valuesIllegalArgumentException
- 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 trueValue, String falseValue, boolean ignoreCase, BoolCellProcessor next)
trueValue
- the String which represents truefalseValue
- the String which represents falseignoreCase
- whether to ignore the case when comparing against the true/false valuesnext
- 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 ParseBool(String[] trueValues, String[] falseValues, boolean ignoreCase, BoolCellProcessor next)
trueValues
- the array of Strings which represent truefalseValues
- the array of Strings which represent falseignoreCase
- whether to ignore the case when comparing against the true/false valuesnext
- 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
value
- the value to be processedcontext
- the CSV contextSuperCsvCellProcessorException
- if value is null, not a String, or can't be parsed to a BooleanCopyright © 2007–2015 Super CSV. All rights reserved.