commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [CSV] Some tweaks for working with headers
Date Sun, 01 May 2016 20:25:51 GMT
This all sounds good to me.

Gary
On May 1, 2016 12:05 PM, "Benedikt Ritter" <britter@apache.org> wrote:

> Hi,
>
> I often seeing myself doing the following when my csv file has a header
> row:
>
> CSVFormat.RFC4180
>    .withHeader() // use first row as header
>    .withSkipHeaderRecord();
>
> How about combining the two into a method called withFirstRecordAsHeader()
> or something like that?
>
> Further more I find it unsymmetrical that I can retrieve a column value
> from CSVRecord using an enum, but I cannot pass an enum to CSVFormat to
> define a header. So I'd like to add a new overload of withHeader:
>
> withHeader(Class<? extends Enum> headers)
>
> The method would iterate over the enum values defined by the class and use
> the name() method on each value for defining the header. This way I can
> define an enum for my headers, use it when specifying the format and when
> retrieving values from the records.
>
> Thoughts?
> Benedikt
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message