Le 16/01/2014 21:58, Gary Gregory a écrit :

> That would work. What is still not clean or OO is that toMap() means
> nothing when no headers are defined.

Well, so be it.


> I've split the record into a mapped record subclass here:
> 
> https://issues.apache.org/jira/browse/CSV-104
> 
> Thoughts?

I'm not sure to like it. I assume a header is used in a majority of
cases, so people will end up using CSVMappedRecord almost exclusively
and that won't make a big difference with the current CSVRecord.

Also, I had some hope to later be able to parametrize the format and
have an automatic object creation on parsing (using annotations).
Something like:

CSVFormat<Person> format = CSVFormat.DEFAULT.withType(Person.class);
for (Person person : format.parse(in)) {
    ...
}

It's ruined by the record type parameter on CSVFormat.


> We can still have toMap() implemented on top of the code now, but it would
> have to return null if there are no headers.

That's fine for me.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to