Class 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
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RowValidatorAggregator

        public RowValidatorAggregator()
        Default constructor.
    • 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.