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

 ##########
 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:
   Does the builder also have thread safety issues? Otherwise it might be a 
good idea to save instantiations by keeping the builder instead of using a new 
one every time.

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