public ReadCSV(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(builder, config, parent, child, context);
String separator = getConfigs().getString(config, "separator", ",");
if (separator.length() != 1) {
throw new MorphlineCompilationException("CSV separator must be one character only: " + separator, config);
}
this.separatorChar = separator.charAt(0);
this.columnNames = getConfigs().getStringList(config, "columns");
this.charset = getConfigs().getCharset(config, "charset", null);
this.ignoreFirstLine = getConfigs().getBoolean(config, "ignoreFirstLine", false);
this.trim = getConfigs().getBoolean(config, "trim", true);
this.addEmptyStrings = getConfigs().getBoolean(config, "addEmptyStrings", true);
this.quoteChar = getConfigs().getString(config, "quoteChar", "");
if (quoteChar.length() > 1) {
throw new MorphlineCompilationException(
"Quote character must not have a length of more than one character: " + quoteChar, config);
}
if (quoteChar.equals(String.valueOf(separatorChar))) {
throw new MorphlineCompilationException(
"Quote character must not be the same as separator: " + quoteChar, config);
}
this.commentPrefix = getConfigs().getString(config, "commentPrefix", "");
if (commentPrefix.length() > 1) {
throw new MorphlineCompilationException(
"Comment prefix must not have a length of more than one character: " + commentPrefix, config);
}
this.maxCharactersPerRecord = getConfigs().getInt(config, "maxCharactersPerRecord", 1000 * 1000);
this.ignoreTooLongRecords = new Validator<OnMaxCharactersPerRecord>().validateEnum(
config,