2014/1/16 Gary Gregory <garydgreg...@gmail.com>

> Maybe we _should_ revisit splitting the record class. Now, we have the
> following slots:
>
> CSVRecord:
> comment : String
> mapping : Map<String, Integer>
> recordNumber : long
> values : String[]
>
> If we take out mapping and put in it a subclass, that reduces the "size" of
> the plain record by 25%:
>
> CSVRecord:
> comment : String
> recordNumber : long
> values : String[]
>
> CSVRecordMap extends CSVRecord
> mapping : Map<String, Integer>
>
> or:
>
> CSVRecordMap extends CSVRecord implements Map<String, String>
> mapping : Map<String, Integer>
>
>
> Thoughts?
>

Sounds like a nice idea. We would have to change how the parsing works,
because currently CSVParser implements Iterable<CSVRecord>. We would need a
method that returns an Iterable<CSVRecord> and one that returns an
Iteable<CSVRecordMap> (or MappedCSVRecord?).

We had this discussion [1] a while back, where Paul Benedict mentioned that
the whole design of a Parser that is an Iterable may not be completely
sound.

Benedikt

[1] http://markmail.org/message/occadenoj2nycneh


>
> Gary
>
>
> On Wed, Jan 15, 2014 at 11:22 AM, Emmanuel Bourg <ebo...@apache.org>
> wrote:
>
> > Le 15/01/2014 07:17, Benedikt Ritter a écrit :
> > > A wrapper of some kind like Adrian suggested sounds like the way to go
> > > here. Maybe we could have something like:
> > >
> > > Map<String, String> map = CSVRecordUtils.toMap(record);
> >
> > I had something like that in mind too, but I would rather use
> > record.toMap() and avoid exposing a new class.
> >
> > Emmanuel Bourg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> > For additional commands, e-mail: dev-h...@commons.apache.org
> >
> >
>
>
>  --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Reply via email to