On Tue, Nov 29, 2011 at 2:34 AM, Emmanuel Bourg <[email protected]> wrote:
> Le 28/11/2011 21:33, Erhan Bagdemir a écrit :
>
>> Apache JCA
>> Java CSV API :-)
>> It is a very cool approach to use annotations for mapping CSV fields with
>> beans.
>>
>> It can be even configured using a class annotation like this:
>> @CSVEntity(seperator= COMMA, quotas=true|false,... )
>> public class Person {
>> @CSVField(header="NAME", width=15)
>> }
>>
>> But how will the Collections be handled ?
>
>
> Collections are probably out of the scope of [csv]. The best we could do is
> splitting a field on a secondary delimiter, something like this:
>
> foo;bar;element1:element2
>
> with a bean declaration like:
>
> public class Bean {
> @CSVField String foo;
>
> @CSVField String bar;
>
> @CSVField(split=":")
> String[] elements;
> }
>
Well, assuming "header-free" CSV output you could do any odd thing like:
foo;bar;(2);element1;element2;
giving an open-ended format. Not saying such would be the greatest
idea, but could be usable under the right circumstances.
Alternatively, one could embed the collection:
foo;bar;"{element1;element2}"
Just food for thought,
Matt
> Emmanuel Bourg
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]