Package com.opencsv.validators
Class RowValidatorAggregator
- java.lang.Object
-
- com.opencsv.validators.RowValidatorAggregator
-
public class RowValidatorAggregator extends java.lang.Object
The aggregator purpose is to collect multiple RowValidators and run them against a single array of Strings. This way complex validations can be performed.- Since:
- 5.0
- Author:
- Scott Conway
-
-
Constructor Summary
Constructors Constructor Description RowValidatorAggregator()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValidator(RowValidator validator)
Add an validator to the aggregator.boolean
isValid(java.lang.String[] row)
Runs all RowValidator isValid command against the line.void
validate(java.lang.String[] row)
Runs all RowValdators validate commands and if the string is invalid then it combines all the validation error messages in a single CsvValidationException.
-
-
-
Method Detail
-
addValidator
public void addValidator(RowValidator validator)
Add an validator to the aggregator.- Parameters:
validator
- - validator to be added.
-
isValid
public boolean isValid(java.lang.String[] row)
Runs all RowValidator isValid command against the line. This is a short circuit and - as soon as one validator returns false then false is return.- Parameters:
row
- - Array of Strings to be validated.- Returns:
- true if all validators isValid methods returns true, false otherwise.
-
validate
public void validate(java.lang.String[] row) throws CsvValidationException
Runs all RowValdators validate commands and if the string is invalid then it combines all the validation error messages in a single CsvValidationException.- Parameters:
row
- - Array of Strings to be validation.- Throws:
CsvValidationException
- - thrown if the string is invalid.
-
-