porcelli commented on code in PR #6195: URL: https://github.com/apache/incubator-kie-drools/pull/6195#discussion_r1884309661
########## drools-decisiontables/src/main/java/org/drools/decisiontable/parser/csv/CsvLineParser.java: ########## @@ -1,150 +1,93 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.drools.decisiontable.parser.csv; import java.util.ArrayList; import java.util.List; /** - * - * a CSV line, with all the normal CSV features. + * A simple parser for CSV (Comma-Separated Values) format. + * Supports quoted fields, escaped quotes, and custom delimiters. */ public class CsvLineParser { - private ICsvParser lineParser; - - public CsvLineParser() { - this.lineParser = new CsvParserImpl(); - } + private final char delimiter; /** - * Use the current lineParser implementation to return a CSV line as a List - * of cells. (Strings). + * Creates a CSV parser with comma as the default delimiter. */ - public List<String> parse(final CharSequence line) { - return this.lineParser.parse( line.toString() ); + public CsvLineParser() { + this(','); } /** - * This is insurance incase I need to replace it with more complex Csv - * handlers in the future. + * Creates a CSV parser with a custom delimiter. + * + * @param delimiter The character to use as field delimiter */ - static interface ICsvParser { - public List<String> parse(String line); + public CsvLineParser(char delimiter) { + this.delimiter = delimiter; Review Comment: good point, I wasn't completely sure and that's why cheated and sent this way so to have the CI tell me that if in the codebase we had this used somehow :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
