commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erhan Bagdemir <erhan.bagde...@googlemail.com>
Subject Re: [csv] API design
Date Mon, 28 Nov 2011 22:55:13 GMT
I meant the Collection members of beans. 
I think that it won't be so easy to 
hold a complex data structure in human-readable form in a "singe" csv file. 



Am 28.11.2011 um 22:28 schrieb Simone Tripodi:

> What do you mean by collections? A single collection of CSV annotated
> elements, or inner collection of a CSV annotated element?
> I have doubts on option #2, I would expect that any CSV record is
> mapped to a single Java POJO... or not?
> Simo
> 
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
> 
> 
> 
> On Mon, Nov 28, 2011 at 9:33 PM, Erhan Bagdemir
> <erhan.bagdemir@googlemail.com> wrote:
>> 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 ?
>> 
>> 
>> Am 28.11.2011 um 21:14 schrieb Simone Tripodi:
>> 
>>> Hi all,
>>> I like the idea of having annotations, and here in CVS you are
>>> proposing IMHO a very good approach. If you need some support, as
>>> mentioned by Matt, I already deeply explored Annotations analysis at
>>> runtime, have a look at[1]
>>> 
>>> @Matt: you reminded me an old idea I had about opening the digester to
>>> other formats, not just XML... coming soon with a new proposal :)
>>> 
>>> Have a nice day,
>>> Simo
>>> 
>>> [1] http://commons.apache.org/digester/guide/annotations.html
>>> 
>>> http://people.apache.org/~simonetripodi/
>>> http://simonetripodi.livejournal.com/
>>> http://twitter.com/simonetripodi
>>> http://www.99soft.org/
>>> 
>>> 
>>> 
>>> On Mon, Nov 28, 2011 at 6:09 PM, Matt Benson <gudnabrsam@gmail.com> wrote:
>>>> On Fri, Nov 11, 2011 at 12:50 PM, Emmanuel Bourg <ebourg@apache.org>
wrote:
>>>> [SNIP]
>>>>> 
>>>>> The other idea relates to the bean mapping feature. CSVFormat could be
>>>>> generified and work on annotated classes. I imagine something like this:
>>>>> 
>>>>>    public class Person {
>>>>>        @CSVField(trim = true)
>>>>>        private String firstname;
>>>>> 
>>>>>        @CSVField(header="NAME", width=12)
>>>>>        private String lastname;
>>>>> 
>>>>>        @CSVField(header="DATE", format="yyyy-MM-dd")
>>>>>        private Date birthdate;
>>>>>    }
>>>>> 
>>>>> then:
>>>>> 
>>>>>    CSVFormat<Person> format = new CSVFormat().withType(Person.class);
>>>>> 
>>>>>    for (Person person : format.parse(in)) {
>>>>>        ....
>>>>>    }
>>>>> 
>>>>> 
>>>>> What do you think?
>>>> 
>>>> These make me think of the annotation support Simo added to
>>>> [digester].  I wonder if there would be any value in extending
>>>> [digester]'s scope to formats beyond XML including CSV/flat files/etc.
>>>> 
>>>> Matt
>>>> 
>>>>> 
>>>>> 
>>>>> Emmanuel Bourg
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


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


Mime
View raw message