public class Token extends CellProcessorAdaptor implements BoolCellProcessor, DateCellProcessor, DoubleCellProcessor, LongCellProcessor, StringCellProcessor
For example, to convert the String "[empty]" to -1 (an int representing 'empty') you could use
new Token("[empty]", -1)
Comparison between the input and the token is based on the object's equals() method.
next
Constructor and Description |
---|
Token(Object token,
Object returnValue)
Constructs a new Token processor, which returns the supplied value if the token is encountered,
otherwise it returns the input unchanged.
|
Token(Object token,
Object returnValue,
CellProcessor next)
Constructs a new Token processor, which returns the supplied value if the token is encountered,
otherwise it passes the input unchanged to 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 Token(Object token, Object returnValue)
token
- the tokenreturnValue
- the value to return if the token is encounteredpublic Token(Object token, Object returnValue, CellProcessor next)
token
- the tokenreturnValue
- the value to return if the token is encounterednext
- the next processor 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 contextSuperCsvCellProcessorException
- if value is nullCopyright © 2007–2015 Super CSV. All rights reserved.