I'm trying to generate Java POJO classes automatically from csv files where the first line contains headers and the other ones contain data. I found many examples and tools in the net showing how to parse csv files and put data into Java objects but in all of them Java POJO classes have already been created manually and I'm looking for a tool which generates them automatically. Otherwise I need a tool similar to Hibernate reverse engineering Tools but instead of databases I've csv files.
For example here is my input csv file:
username, password, date, zip, town
Klaus, qwexyKiks, 17/1/2007,1111, New York
Oufu1, bobilops, 10/10/2007,4555, New York
And here is what I need to generate automatically:
package test;
import java.util.Date;
public class UserBean {
String username;
String password;
Date date;
int zip;
String town;
public Date getDate() {
return date;
}
public String getPassword() {
return password;
}
public String getTown() {
return town;
}
public String getUsername() {
return username;
}
public int getZip() {
return zip;
}
public void setDate(final Date date) {
this.date = date;
}
public void setPassword(final String password) {
this.password = password;
}
public void setTown(final String town) {
this.town = town;
}
public void setUsername(final String username) {
this.username = username;
}
public void setZip(final int zip) {
this.zip = zip;
}
}