public CsvConverter(Map<String, Object> config) throws ConfigurationException {
super(Type.CSV, config);
try {
String columnHeader = (String) config.get("column_header");
if (columnHeader == null || columnHeader.isEmpty()) {
throw new ConfigurationException("Missing column headers.");
}
separator = firstCharOrDefault(config.get("separator"), CSVParser.DEFAULT_SEPARATOR);
quoteChar = firstCharOrDefault(config.get("quote_char"), CSVParser.DEFAULT_QUOTE_CHARACTER);
escapeChar = firstCharOrDefault(config.get("escape_char"), CSVParser.DEFAULT_ESCAPE_CHARACTER);
strictQuotes = Objects.firstNonNull((Boolean) config.get("strict_quotes"), false);
trimLeadingWhiteSpace = Objects.firstNonNull((Boolean) config.get("trim_leading_whitespace"), true);
final CSVParser parser = getCsvParser();
fieldNames = parser.parseLine(columnHeader);
if (fieldNames.length == 0) {
throw new ConfigurationException("No field names found.");
}
} catch (Exception e) {
throw new ConfigurationException("Invalid configuration for CsvConverter");
}
}