Class InventoryCsvValidator

java.lang.Object
com.amilesend.discogs.csv.InventoryCsvValidator

public class InventoryCsvValidator extends Object
Utility to read an inventory CSV file and validate its contents based on the specification as described in the API Documentation.
  • Constructor Details

    • InventoryCsvValidator

      public InventoryCsvValidator()
      Creates a new InventoryCsvValidator instance with the default CSVFormat configured.
      See Also:
      • CSVFormat.RFC4180
    • InventoryCsvValidator

      public InventoryCsvValidator(@NonNull org.apache.commons.csv.CSVFormat csvFormat)
  • Method Details

    • validate

      public void validate(@NonNull Path csvFile, @NonNull InventoryRecordType type) throws IOException, ValidationException
      Validates an inventory CSV file by:
      • Validating that headers are recognized
      • Required headers are present
      • Contents adhere to column value constraints
      Parameters:
      csvFile - the CSV file to validate
      type - the type of operation that the CSV file is for (i.e., new inventory, or updating existing inventory items).
      Throws:
      IOException - if an error occurred while attempting to read the file
      ValidationException - if the file failed validation. See ValidationException.getErrors() for a detailed description of each validation error
      See Also: