You can certainly do this with Super CSV using CsvDozerBeanReader. See this example on the website.
It's also explained in a bit more detail on this SO answer.
You may also be interested in this recent question, as it demonstrates the different ways to achieve deep/indexed mapping with Super CSV (with and without using Dozer).
Following the CsvDozerBeanReader
example on the website, to read the CSV from your question you would use a field mapping of:
final String[] fieldMapping = new String[]{
"uniqueId",
"name",
"selfRegEnabled",
"addrList[0].type",
"addrList[0].line1",
"addrList[0].line2",
"addrList[0].line3",
"addrList[0].city",
"addrList[0].state",
"addrList[0].zip",
"addrList[0].country",
"addrList[1].type",
"addrList[1].line1",
"addrList[1].line2",
"addrList[1].line3",
"addrList[1].city",
"addrList[1].state",
"addrList[1].zip",
"addrList[1].country",
"addrList[2].type",
"addrList[2].line1",
"addrList[2].line2",
"addrList[2].line3",
"addrList[2].city",
"addrList[2].state",
"addrList[2].zip",
"addrList[2].country"
};
Also, because the selfRegEnabled
field is a boolean, you'll need to use cell processors to transform the String value into a Boolean - to do this you'd use the ParseBool
processor.