I'm trying to do the following, but am struggling with what would be the best approach, can anyone point me in the right direction?
I have a Java program with one simple POJO (let's say 5 properties), representing a Person, with which I want to convert exports from multiple source systems into, to store in my own database table.
public class Person
String salutation;
String first_name;
String last_name;
String email;
These sources can export their data with extra information that is not needed by the POJO (i.e. more than the 4 properties I have defined). So the XLS could look like this...
firstname secondname address1 address2 fax phone email
John Smith My Street 873637 2323829 [email protected]
My thought was to use POI (XSSFWorkbook) and find the Strings in the Header rows (firstname etc) - then, using an XML file that specifies the mapping (firstname = first_name), store the column index where I find the POJO property in a Map (with the column heaer), then loop through each row creating an object based on the mapping of property/header name/column index and the POJO properties.
Can anyone suggest if this is on the correct path?