Newer
Older
csv-parser / README.md
@aljunggren aljunggren on 14 May 2021 697 bytes Added unit testing

CSV-Parser

Parse CSV and map to a given class.

Parser parser = new Parser();
List<MyClass> results = parser.parse(file, MyClass.class);

Annotate private member variables with @CSVColumn. Set value equal to the name of the column as viewed in Excel

@CSVColumn(value = "A")

Defining class map

public class MyClass {
    @CSVColumn(value = "A")
    private String firstName;
    
    @CSVColumn(value = "B")
    private String lastName;
    
    @CSVColumn(value = "G")
    private int age;
    
    // Getters & Setters
}

CSV Date

Converts value to Date

@CSVDate(pattern = "MM-dd-yyyy")

Data types supported

  • Date

Format used by java.text.SimpleDateFormat