Class LineValidatorAggregator


  • public class LineValidatorAggregator
    extends java.lang.Object
    The aggregator purpose is to collect multiple LineValidators and run them against a single line. 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​(LineValidator validator)
      Add an validator to the aggregator.
      boolean isValid​(java.lang.String line)
      Runs all LineValidators isValid command against the line.
      void validate​(java.lang.String line)
      Runs all LineValdators 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

      • LineValidatorAggregator

        public LineValidatorAggregator()
        Default constructor.
    • Method Detail

      • addValidator

        public void addValidator​(LineValidator validator)
        Add an validator to the aggregator.
        Parameters:
        validator - - validator to be added.
      • isValid

        public boolean isValid​(java.lang.String line)
        Runs all LineValidators isValid command against the line. This is a short circuit and - as soon as one validator returns false then false is return.
        Parameters:
        line - - string to be validated.
        Returns:
        true if all validators isValid methods returns true, false otherwise.
      • validate

        public void validate​(java.lang.String line)
                      throws CsvValidationException
        Runs all LineValdators validate commands and if the string is invalid then it combines all the validation error messages in a single CsvValidationException.
        Parameters:
        line - - string to be validation.
        Throws:
        CsvValidationException - - thrown if the string is invalid.