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