Class CsvExporter

java.lang.Object
com.e1c.langtool.internal.stat.export.CsvExporter
All Implemented Interfaces:
IStatisticsExporter

public class CsvExporter extends Object implements IStatisticsExporter
Implements the IStatisticsExporter interface to export statistics to a CSV file. This class handles the conversion of statistical data provided by a StatisticsProvider into a comma-separated values (CSV) format, suitable for analysis and reporting. It supports exporting data for multiple languages and metrics, organizing the output into columns for each metric and rows for each language. Errors encountered during the export process are logged for troubleshooting.
  • Constructor Details

    • CsvExporter

      public CsvExporter()
  • Method Details

    • export

      public void export(Path path, StatisticsProvider provider, Collection<TranslateLanguage> languages, Collection<Metric> metrics) throws IOException
      Exports provided statistics data to a CSV file. This method formats the statistics according to the given languages and metrics, then writes them to the specified path. Each row in the CSV represents a language, and each column represents a metric. If an error occurs during the export process, it is thrown to the caller.
      Specified by:
      export in interface IStatisticsExporter
      Parameters:
      path - The Path where the exported data should be saved. This path must be accessible and writable by the implementation. Must not be null.
      provider - The StatisticsProvider that supplies the statistical data to be exported. Must not be null.
      languages - A Collection of TranslateLanguage objects specifying the languages for which statistics should be exported. If empty, the implementation may decide to export statistics for all available languages. Must not be null.
      metrics - A Collection of Metric objects defining the specific statistical measurements to be included in the export. If empty, the implementation may decide to include all available metrics. Must not be null.
      Throws:
      IOException - if an I/O error occurs during the export process. Implementations should ensure to handle such exceptions appropriately.