arjansh commented on a change in pull request #221: Access CSVParser in a 
synchronized manner
URL: https://github.com/apache/metamodel/pull/221#discussion_r293779573
 
 

 ##########
 File path: csv/src/main/java/org/apache/metamodel/csv/CsvConfiguration.java
 ##########
 @@ -195,4 +199,17 @@ public String toString() {
                 + ", separatorChar=" + separatorChar + ", quoteChar=" + 
quoteChar + ", escapeChar=" + escapeChar
                 + ", failOnInconsistentRowLength=" + 
failOnInconsistentRowLength + "]";
     }
+    
+    public ICSVParser createParser() {
+        if (getEscapeChar() == getQuoteChar()) {
+            return new 
RFC4180ParserBuilder().withSeparator(getSeparatorChar()).withQuoteChar(getQuoteChar()).build();
+        } else {
+            return new CSVParserBuilder()
+                    .withSeparator(getSeparatorChar())
+                    .withQuoteChar(getQuoteChar())
+                    .withEscapeChar(getEscapeChar())
+                    .build();
 
 Review comment:
   As far as I know the builder doesn't have those issues, but I refrained from 
that up until now because the _RFC4180ParserBuilder_ and the _CSVParserBuilder_ 
don't share one super class or interface.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to