Class JsonExporter

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

public class JsonExporter extends Object implements IStatisticsExporter
Implements the IStatisticsExporter interface to export statistical data into a JSON file. This class takes statistics data from a provided StatisticsProvider, including specific languages and metrics, and writes them to a specified file in JSON format. The JSON structure is designed to be easily readable and can accommodate various metrics for each translation language. Errors encountered during the export process are logged.
  • Constructor Details

    • JsonExporter

      public JsonExporter()
  • Method Details

    • export

      public void export(Path path, StatisticsProvider provider, Collection<TranslateLanguage> languages, Collection<Metric> metrics) throws IOException
      Exports the provided statistical data to a JSON file at the specified path. The data includes metrics for translation languages provided by the StatisticsProvider.
      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.