public class RequireHashCode extends CellProcessorAdaptor implements BoolCellProcessor, DateCellProcessor, DoubleCellProcessor, LongCellProcessor, StringCellProcessor
This constraint is a very efficient way of ensuring constant expressions are present in certain columns of the CSV file, such as "BOSS", "EMPLOYEE", or when a column denotes an action to be taken for the input line such as "D" (delete), "I" (insert), ...
next
Constructor and Description |
---|
RequireHashCode(int... requiredHashcodes)
Constructs a new RequireHashCode processor, which converts the input to a String, and ensures that the
input's hash function matches any of a given set of hashcodes.
|
RequireHashCode(int[] requiredHashcodes,
CellProcessor next)
Constructs a new RequireHashCode processor, which converts the input to a String, ensures that the
input's hash function matches any of a given set of hashcodes, then calls the next processor in the chain.
|
RequireHashCode(int requiredHashcode,
CellProcessor next)
Constructs a new RequireHashCode processor, which converts the input to a String, ensures that the
input's hash function matches the supplied hashcode, then calls 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 RequireHashCode(int... requiredHashcodes)
requiredHashcodes
- one or more hashcodesNullPointerException
- if requiredHashcodes is nullIllegalArgumentException
- if requiredHashcodes is emptypublic RequireHashCode(int requiredHashcode, CellProcessor next)
requiredHashcode
- the required hashcodenext
- the next processor in the chainNullPointerException
- if next is nullpublic RequireHashCode(int[] requiredHashcodes, CellProcessor next)
requiredHashcodes
- one or more hashcodesnext
- the next processor in the chainNullPointerException
- if requiredHashcodes or next is nullIllegalArgumentException
- if requiredHashcodes is emptypublic Object execute(Object value, CsvContext context)
execute
in interface CellProcessor
value
- the value to be processedcontext
- the CSV contextSuperCsvCellProcessorException
- if value is nullSuperCsvConstraintViolationException
- if value isn't one of the required hash codesCopyright © 2007–2015 Super CSV. All rights reserved.