Thanks for the code - much easier to understand now :)
You should be able to read each row of CSV as a MyPhoneContactMethodData
instance by using the following bean mapping. Just make sure you call configureBeanMapping()
with this before reading (as shown on the Super CSV website).
You will then have to manually create the Contact
and add the MyPhoneContactMethodData
to the contactMethodData
map, using with ContactMethod.PHONE
as the key (as done in the last 3 lines of your code).
final String[] beanMapping = new String[]{
"phones[0].phoneNumber",
"phones[1].phoneNumber",
"phones[2].phoneNumber",
"enterpriseCallVarData[0]",
"enterpriseCallVarData[1]",
"enterpriseCallVarData[2]",
"enterpriseCallVarData[3]",
"enterpriseCallVarData[4]",
"enterpriseCallVarData[5]",
"enterpriseCallVarData[6]",
"enterpriseCallVarData[7]",
"enterpriseCallVarData[8]",
"enterpriseCallVarData[9]"
};
beanReader.configureBeanMapping(MyPhoneContactMethodData.class, beanMapping);
MyPhoneContactMethodData methodData;
while( (methodData =
beanReader.read(MyPhoneContactMethodData.class, CELL_PROCESSORS)) != null ) {
// add to contact
}