Interface LineValidator


  • public interface LineValidator
    This is the interface for validators for a String read by the Reader in the CSVReader before it is processed.

    This should only be used if you have a very good understanding and full control of the data being processed.

    Since this is working on an individual line it may not be a full record if an element has a newline character in it.

    Since:
    5.0
    Author:
    Scott Conway
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isValid​(java.lang.String line)
      Performs the validation check on the string and returns the result.
      void validate​(java.lang.String line)
      Performs the validation check on the string and throws an exception if invalid.
    • Method Detail

      • isValid

        boolean isValid​(java.lang.String line)
        Performs the validation check on the string and returns the result. While not called directly in opencsv it is in the interface to provide an easy way to test if the validator is function properly.
        Parameters:
        line - String to be validated
        Returns:
        true if the line is valid, false otherwise
      • validate

        void validate​(java.lang.String line)
               throws CsvValidationException
        Performs the validation check on the string and throws an exception if invalid.
        Parameters:
        line - String to be validated
        Throws:
        CsvValidationException - Thrown if invalid. Should contain a message describing the error.