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 and 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 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, validateInputNotNullpublic 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 CellProcessorvalue - the value to be processedcontext - the CSV contextCopyright © 2007–2015 Super CSV. All rights reserved.