42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility
Apache License 2.0
100 stars 22 forks source link

Declarative instructions must make use of the standard Bean parser wherever possible #27

Open robert-bor opened 11 years ago

robert-bor commented 11 years ago

When annotations are used, a Bean is parsed and default indexes are drawn up.

This should also be done when annotations are not used.

At the moment you still have to declare a number of steps which are unnecessary:

        CsvReader<Bean> csvReader = new CsvReaderImpl<Bean>(reader, new BeanReaderInstructionsImpl(Bean.class))
                .setMapper(ColumnNameMapper.class)
                .mapColumnNameToProperty("name", "name")
                .mapColumnNameToProperty("number", "number")
                .mapColumnNameToProperty("date", "date")
                .setDate("date", "dd-MM-yyyy");

This should be:

        CsvReader<Bean> csvReader = new CsvReaderImpl<Bean>(reader, new BeanReaderInstructionsImpl(Bean.class))
                .setMapper(ColumnNameMapper.class)
                .setDate("date", "dd-MM-yyyy");