Package org.nuiton.csv


package org.nuiton.csv
This package contains a framework to import and export data from a csv file using a model which permits us to validate what to do.

Exporter API (since 3.0)

Steps to export

  • create an exporter (and configure it)
  • perform export using the exporter

Example from a legacy model (with default configuration values)

    ExportModel<O> model = ...;
    Exporter<O> exporter = Exporter.of(model);
    Iterable<O> data = ...;
    String csv = exporter.writeToString(data);

Example from scratch

    ExportModel<O> model = ...;
    Exporter<O> exporter = Exporter
                                 .<O>builder()
                                 .addColum("propertyName")
                                 .addColum("headerName", "propertyName")
                                 .setCellSeparator(",")
                                 .build();
    Iterable<O> data = ...;
    String csv = exporter.writeToString(data);
Since:
2.4
Author:
Tony Chemit - chemit@codelutin.com