For reasons I’ll never understand, my little Apache2 open source CSV parser, opencsv has recently trucked through the 20,000 download mark.

Thanks to some wonderful work from Kyle Miller, I’ve just shipped version 1.8 which includes Kyle’s neat little Bean binding framework. Using one of Kyle’s various binding strategies (column position, column name, custom strategy), you can now bind a CSV file to a list of beans:

      ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy();
      strat.setType(YourOrderBean.class);
      String[] columns = new String[] {"name", "orderNumber", "id"};
      strat.setColumnMapping(columns);

      CsvToBean csv = new CsvToBean();
      List list = csv.parse(strat, yourReader);

Great stuff, Kyle!

You can grab the new version from the download page, or checkout the javadoc, or see some sample usage scenarios.

Enjoy!