CsvBindAndJoinByName not working with Regex
Brought to you by:
aruckerjones,
sconway
I made a csv
row,bloomberg,anwar_12,anwar_more_12
1,Anwar,Saleh,noway
public class TestModel {
@CsvBindByName(column = "row") int row; @CsvBindByName(column = "name") String name; @CsvBindAndJoinByName(column = "^anwar_\\d{2}$", elementType = String.class) MultiValuedMap<String, String> anwar; @CsvBindAndJoinByName(column = "^anwar_more_\\d{2}$", elementType = String.class) MultiValuedMap<String, String> anwarMore; //setters and getters
}
and its not working
adjusting the bloomberg should be name
row,name,anwar_12,anwar_more_12
1,Anwar,Saleh,noway
Last edit: Anwar Saleh 2018-08-09
So the mulitvaluedmap doesnt not contain the column and value, that matches
the regex.
They always contain null
On Thu, 9 Aug 2018 at 20:13, Andrew Rucker Jones aruckerjones@users.sourceforge.net wrote:
Related
Bugs:
#178Could you specify what you mean by "it's not working"? I just ran a test with exactly the information you sent and everything works fine for me.
Could you please attach a test case that demonstrates this? I can't reproduce the problem.
I done few adjustments to make it simpler
Reading in file method.
Model used
Ah. I haven't had the time yet to test your newest attachment (I'm in the middle of another development), but I have a suspicion: Don't use the Iterator. It should work, of course, and I'll fix it, but I suspect that's the problem.
I done the following
@Test
public void csv_Test() throws IOException {
Reader reader;
reader = new InputStreamReader(new FileInputStream(new
File("E:\testing_folder\Testing.csv")), "Cp1252");
List<testmodel> listOfModel = new
CsvToBeanBuilder<testmodel>(reader).withType(TestModel.class).build().parse();</testmodel></testmodel>
reader.close();
}
The result is the same.
I appreciate the work you are doing, but would you know when your able to
get round to this?
Thank you in advance.
On Fri, Aug 10, 2018 at 2:04 PM, Andrew Rucker Jones aruckerjones@users.sourceforge.net wrote:
Related
Bugs:
#178Honest estimate? I think I'm aiming for a release in September, which would include a fix for this bug, if I can reproduce it.
Once again, I copied your (new) code and your data and I cannot reproduce your problem. Can you please verify with a hex editor that your input file only includes the characters you expect it to include? Sometimes there is an invisible BOM at the beginning of the file. I could also imagine files encoded in a wide character set, which opencsv would not be able to parse properly unless the file is read in with the proper encoding.
Lacking a response and a way to reproduce this, I'm closing the ticket.