Package org.supercsv.cellprocessor
Class Optional
java.lang.Object
org.supercsv.cellprocessor.CellProcessorAdaptor
org.supercsv.cellprocessor.ConvertNullTo
org.supercsv.cellprocessor.Optional
- All Implemented Interfaces:
BoolCellProcessor
,CellProcessor
,DateCellProcessor
,DoubleCellProcessor
,LongCellProcessor
,StringCellProcessor
This processor is used to indicate that a cell is optional, and will avoid executing further processors if it
encounters null. It is a simple customization of ConvertNullTo.
Prior to version 2.0.0, this processor returned null for empty String (""), but was updated because
Tokenizer now reads empty columns as null. It also means that Optional can now be used when writing as well
(instead of using ConvertNullTo("")
).
-
Field Summary
Fields inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
next
-
Constructor Summary
ConstructorsConstructorDescriptionOptional()
Constructs a new Optional processor, which when encountering null will return null, for all other values it will return the value unchanged.Optional
(CellProcessor next) Constructs a new Optional processor, which when encountering null will return null , for all other values it will call the next processor in the chain. -
Method Summary
Methods inherited from class org.supercsv.cellprocessor.ConvertNullTo
execute
Methods inherited from class org.supercsv.cellprocessor.CellProcessorAdaptor
toString, validateInputNotNull
-
Constructor Details
-
Optional
public Optional()Constructs a new Optional processor, which when encountering null will return null, for all other values it will return the value unchanged. -
Optional
Constructs a new Optional processor, which when encountering null will return null , for all other values it will call the next processor in the chain.- Parameters:
next
- the next CellProcessor in the chain- Throws:
NullPointerException
- if next is null
-