BoolCellProcessor
, CellProcessor
, DateCellProcessor
, DoubleCellProcessor
, LongCellProcessor
, StringCellProcessor
Optional
public class ConvertNullTo extends CellProcessorAdaptor implements BoolCellProcessor, DateCellProcessor, DoubleCellProcessor, LongCellProcessor, StringCellProcessor
To return the String "" when a null is encountered use
new ConvertNullTo("\"\"");
If you need further processing of the value in case the value is not null, you can link the processor with
other processors such as
new ConvertNullTo("\"\"", new Truncate(3))
next
Constructor | Description |
---|---|
ConvertNullTo(Object returnValue) |
Constructs a new ConvertNullTo processor, which returns a specified default value if the input is
null.
|
ConvertNullTo(Object returnValue,
CellProcessor next) |
Constructs a new ConvertNullTo processor, which returns a specified default value if the input is
null.
|
Modifier and Type | Method | 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 ConvertNullTo(Object returnValue)
returnValue
- the value to return if the input is nullpublic ConvertNullTo(Object returnValue, CellProcessor next)
returnValue
- the value to return if the input is nullnext
- the next CellProcessor in the chainNullPointerException
- if next is nullpublic Object execute(Object value, CsvContext context)
execute
in interface CellProcessor
value
- the value to be processedcontext
- the CSV contextCopyright © 2007–2018 Super CSV. All rights reserved.