MasterEx commented on a change in pull request #2169:
URL: https://github.com/apache/netbeans/pull/2169#discussion_r464080921



##########
File path: 
ide/db.dataview/src/org/netbeans/modules/db/dataview/output/dataexport/CSVCommonsDataExporter.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.netbeans.modules.db.dataview.output.dataexport;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVPrinter;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * Exports the given data to the target file in the provided CSV format.
+ *
+ * @author Periklis Ntanasis <[email protected]>
+ */
+public interface CSVCommonsDataExporter {
+
+    default void exportData(String[] headers, Object[][] contents, File file, 
CSVFormat format) {

Review comment:
       As you may have seen I have implemented the concrete exporters (i.e. 
`CSVDataExporter`) as `enums` because I wanted them to be singletons and this 
is the way I usually do it. For this reason I haven't considered of using 
abstract classes because I couldn't extend the enums with them.
   
   If you have a strong preference for this to be written as an abstract class 
I don't mind rewrite the code, just let me know.
   
   Another alternative would be to implement `CSVCommonsDataExporter` as a 
concrete class (probably also singleton/enum) and just use it wherever this 
functionality is required. So, that way we would favor composition over 
inheritance and avoid having logic implemented into interfaces. I actually 
think that I prefer this over the current implementation. Please, let me know 
what you think.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to