CSV Parser

@aljunggren aljunggren authored on 19 May 2021
src Updated ParserUtils columnToInt 5 years ago
.gitignore Initial commit 5 years ago
README.md Added unit testing 5 years ago
lombok.config Initial commit 5 years ago
pom.xml Initial commit 5 years ago
README.md

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