Emmanuel Bourg wrote:

> Le 13/03/2012 00:56, sebb a écrit :
> 
>>> 1. Do nothing and address it in the next release with the bean mapping.
>>> Parsing the file would then look like this:
>>>
>>>   CSVFormat<Person>  format = CSVFormat.DEFAULT.withType(Person.class);
>>>   for (Person person : format.parse(in)) {
>>>       persons.add(person);
>>>   }
>>>
>>
>> Does this automatically mean that the file has a header?
>> Or is there another way to link columns to Person attributes?
> 
> If the file doesn't have a header, the fields are matched by index
> (either the natural ordering of the attributes in the class, or
> specified by an annotation).
> 
> If the file has a header, the fields are matched by attribute name, and
> an annotation can override the name of the column associated to an
> attribute.

Yeah, but that's not required. Just because you can read the names of the 
columns does not mean that you want to address them by name. Why pay the 
price for creating the map and accessing the values by name just for a one-
time information?

- Jörg


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

Reply via email to