Class AdvancedCsvProcessor<T>

    • Constructor Detail

      • AdvancedCsvProcessor

        public AdvancedCsvProcessor​(char separator,
                                    List<String> columnDefinition,
                                    Class<T> clazz,
                                    AdvancedCsvProcessorConfig csvProcessorConfig)
        Constructor of a AdvancedCsvProcessor for domain types with simple-typed properties only (int, double, float, long, boolean, char, Integer, Float, Double, Long, String, Character, Boolean)
        Parameters:
        separator - separator used in the csv file
        columnDefinition - columnDefinition of the csv file (can be null for reading if the CSV file contains a header which is used in CSVProcessor.read(File, boolean, boolean))
        clazz - clazz of domain type
        csvProcessorConfig - Configuration for this class. Defines how the header normalization should be handled
      • AdvancedCsvProcessor

        public AdvancedCsvProcessor​(char separator,
                                    List<String> columnDefinition,
                                    Class<T> clazz)
        Constructor of a AdvancedCsvProcessor for domain types with simple-typed properties only (int, double, float, long, boolean, char, Integer, Float, Double, Long, String, Character, Boolean). The configuration is set to a default, meaning only whitespaces of the column headers are trimmed and concatenated into one "word"
        Parameters:
        separator - separator used in the csv file
        columnDefinition - columnDefinition of the csv file (can be null for reading if the CSV file contains a header which is used in CSVProcessor.read(File, boolean, boolean))
        clazz - clazz of domain type
    • Method Detail

      • normalizeColumnDefinition

        protected List<String> normalizeColumnDefinition​(List<String> columnHeader)
        Normalizes the headers according to the AdvancedCsvProcessorConfig. It first removes the strings defined in the config.charactersToRemove, then replaces the strings defined in config.charactersToReplace.
        Overrides:
        normalizeColumnDefinition in class CSVProcessor<T>
        Parameters:
        columnHeader - the extracted column headers to be used to map them to object fields
        Returns:
        normalized column headers as define in the AdvancedCsvProcessorConfig. Should allow mapping of the values to objects.
      • normalizeRow

        protected List<String> normalizeRow​(List<String> csvLine)
        Description copied from class: CSVProcessor
        Defines the normalisation of a singular csv line after the header. Adapter method
        Overrides:
        normalizeRow in class CSVProcessor<T>
        Parameters:
        csvLine - the split line of a csv file.
        Returns:
        the normalized csv lines