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(java.lang.Object returnValue)
Constructs a new ConvertNullTo processor, which returns a specified default value if the input is
null.
|
ConvertNullTo(java.lang.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 |
|---|---|
java.lang.Object |
execute(java.lang.Object value,
CsvContext context)
This method is invoked by the framework when the processor needs to process data or check constraints.
|
toString, validateInputNotNullpublic ConvertNullTo(java.lang.Object returnValue)
returnValue - the value to return if the input is nullpublic ConvertNullTo(java.lang.Object returnValue,
CellProcessor next)
returnValue - the value to return if the input is nullnext - the next CellProcessor in the chainjava.lang.NullPointerException - if next is nullpublic java.lang.Object execute(java.lang.Object value,
CsvContext context)
execute in interface CellProcessorvalue - the value to be processedcontext - the CSV contextCopyright © 2007-2014 Super CSV. All Rights Reserved.