public class RowMustHaveSameNumberOfColumnsAsFirstRowValidator extends Object implements RowValidator
Arrays that are empty or null are considered to have 0 elements. An empty or null first row is considered invalid.
As with all row validators the assumption is you have control of the data and have skipped any initial empty lines. If you have data that has empty lines or separators lines in your data then you should not use this class. Either extend it or write your own validator.
Constructor and Description |
---|
RowMustHaveSameNumberOfColumnsAsFirstRowValidator()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isValid(String[] row)
Performs the validation check on the string and returns the result.
|
void |
validate(String[] row)
Performs the validation check on the row (an array of
String s)
and throws an exception if invalid. |
public RowMustHaveSameNumberOfColumnsAsFirstRowValidator()
public boolean isValid(String[] row)
RowValidator
isValid
in interface RowValidator
row
- Array of strings to be validatedtrue
if the row is valid, false
otherwisepublic void validate(String[] row) throws CsvValidationException
RowValidator
String
s)
and throws an exception if invalid.validate
in interface RowValidator
row
- Array of String
s to be validated.CsvValidationException
- Thrown if invalid. Should contain a
message describing the error.Copyright © 2005–2023. All rights reserved.