Package com.opencsv.validators
Interface RowValidator
-
- All Known Implementing Classes:
RowFunctionValidator
,RowMustHaveSameNumberOfColumnsAsFirstRowValidator
public interface RowValidator
This is the interface for validators for an array ofString
s read by theCSVReader
after it is processed. This should only be used if you have a very good understanding and full control of the data being processed. Good examples of a RowValidator would be to ensure the number of columns in the row or, if you know what data are in which column, check the format and type of data.- Since:
- 5.0
- Author:
- Scott Conway
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isValid(java.lang.String[] row)
Performs the validation check on the string and returns the result.void
validate(java.lang.String[] row)
Performs the validation check on the row (an array ofString
s) and throws an exception if invalid.
-
-
-
Method Detail
-
isValid
boolean isValid(java.lang.String[] row)
Performs the validation check on the string and returns the result. While not called directly in opencsv it is in the interface to provide an easy way to test if the validator is functioning properly.- Parameters:
row
- Array of strings to be validated- Returns:
true
if the row is valid,false
otherwise
-
validate
void validate(java.lang.String[] row) throws CsvValidationException
Performs the validation check on the row (an array ofString
s) and throws an exception if invalid.- Parameters:
row
- Array ofString
s to be validated.- Throws:
CsvValidationException
- Thrown if invalid. Should contain a message describing the error.
-
-