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

 ##########
 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:
   Ah, yes, that definitely makes it harder to do in a sane way (and is a bit 
silly, given that they at least share the `build()` method).

----------------------------------------------------------------
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