You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Joey Pinto (JIRA)" <ji...@apache.org> on 2016/03/25 05:59:25 UTC

[jira] [Created] (CSV-174) Adding methods to support JSON-CSV interchangeability and adding a class/methods to support direct cell modification

Joey Pinto created CSV-174:
------------------------------

             Summary: Adding methods to support JSON-CSV interchangeability and adding a class/methods to support direct cell modification
                 Key: CSV-174
                 URL: https://issues.apache.org/jira/browse/CSV-174
             Project: Commons CSV
          Issue Type: Improvement
          Components: Build
            Reporter: Joey Pinto


I wish to introduce some major features in the Commons CSV that I found really necessary while dealing with CSV file parsing requirements of an ERP for a University.

1.Custom Exceptions:
  Exceptions to be raised when incorrectly formatted CSVs are parsed specifying the row number mentioning reasons like incorrect number of columns.

2. Export to JSON:
PostgreSQL Supports direct import of JSON Code. So to insert data from a CSV into the database I had to first convert it to JSON and then make the insert. If we could have an option to do this directly it would be a lot more time saving.

3.New Class CSVFile
I wish to introduce a new class CSVFile which shall have the entire contents of the CSV stored in nested Array Lists.

I shall have the following methods in the class:
Constructors:
void CSVFile(CSVParser);
void CSVFile(Object [][],boolean has_headers);
void CSVFile(JSON Array,boolean allow_blanks);
void CSVFile(String text,String cell_delimiter,String line_delimiter,boolean force_headerSchema);

Printers:
String CSVFile.toString();
JSONArray CSVFile.toJSONArray();
Object[][] CSVFile.toArray();
ResultSet CSVFile.toResultSet();
ArrayList<Object[]> CSVFile.toArrayList();
ArrayList<ArrayList<Object>> CSVFile.toNestedArrayList();
String CSVFile.toString();

Access:
CSVFile.setColumnHeader(int col_number);
String CSVFile.getCell(int row_number,String header);
String CSVFile.getCell(int row_number,int col_number);
CSVFile.setCell(int row_number,int col_number,String value);
CSVFile.setCell(int row_number,String header,String value);
CSVFile.getRowArray();
JSONObject CSVFile.getRowJSON();

Sorting:
CSVFile.sort(Comparator());

Extraction:
CSVFile CSVFile.getColumns(Arraylist<String> headers);
CSVFile CSVFile.getRows(extractor());
@override 
public boolean include(CSVRecord record){
//if satisfies Condition then include
      return true;
//else return false

   }



Delete:
void CSVFile.removeRow(int row_number);
void CSVFile.remove Section(int start_row,int end_row);
void CSVFile.CSVFile.removeRows(extractor());
void CSVFile.removeColumn(int col_number);
void CSVFile.removeColumn(String header);





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)