I'm trying to write a code where a csv content is converted to a bean. This is how my code looks like
final String TEMPLATE_FILE="addresses.csv";
CSVReader template = new CSVReader(new FileReader(TEMPLATE_FILE));
String [] header = template.readNext();
ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy();
strat.setType(PersonEx.class);
strat.setColumnMapping(header);
CsvToBean csv = new CsvToBean();
List list = csv.parse(strat, template);
In here if a particular attribute of PersonEx.class is missing in the csvHeader that attribute is ascribed as null. Is there a way, I can ignore this and only create a bean of values present in the header?