public class RowValidatorAggregator extends Object
RowValidator
s and
run them against a single array of strings.
This way complex validations can be performed.Constructor and Description |
---|
RowValidatorAggregator()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidator(RowValidator validator)
Add a validator to the aggregator.
|
boolean |
isValid(String[] row)
Runs all
RowValidator s' RowValidator.isValid(String[])
method against the line. |
void |
validate(String[] row)
Runs all
RowValidator s' RowValidator.validate(String[])
methods and if the string array is invalid, then it combines all the
validation error messages in a single CsvValidationException. |
public void addValidator(RowValidator validator)
validator
- Validator to be added.public boolean isValid(String[] row)
RowValidator
s' RowValidator.isValid(String[])
method against the line.
This is a short circuit: as soon as one validator returns false
then false
is returned.row
- Array of strings to be validated.true
if all validators'
RowValidator.isValid(String[])
methods return true
,
false
otherwise.public void validate(String[] row) throws CsvValidationException
RowValidator
s' RowValidator.validate(String[])
methods and if the string array is invalid, then it combines all the
validation error messages in a single CsvValidationException.row
- Array of Strings to be validation.CsvValidationException
- Thrown if the string is invalid.Copyright © 2005–2023. All rights reserved.