CSV > OPEN CSV > CSV to Bean using Column Position Mapping Strategy
CSV to Bean using Column Position Mapping Strategy
opencsv is a free and open source library for reading and writing
CSV files in Java. We need to have opencsv-2.3.jar or
later versions in classpath.
The following example shows populating a java bean from CSV using opencsv.
This strategy is useful when parsing CSVs without any header.
We need to specify an explicit mapping between CSV column position/index and property name of bean
using setColumnMapping method.
The order of properties specified should match with CSV column data.