Class JsonExporter
java.lang.Object
com.e1c.langtool.internal.stat.export.JsonExporter
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexport(Path path, StatisticsProvider provider, Collection<TranslateLanguage> languages, Collection<Metric> metrics) Exports the provided statistical data to a JSON file at the specified path.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.e1c.langtool.stat.IStatisticsExporter
sortStatisticsByPath
-
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 theStatisticsProvider.- Specified by:
exportin interfaceIStatisticsExporter- Parameters:
path- ThePathwhere the exported data should be saved. This path must be accessible and writable by the implementation. Must not benull.provider- TheStatisticsProviderthat supplies the statistical data to be exported. Must not benull.languages- ACollectionofTranslateLanguageobjects specifying the languages for which statistics should be exported. If empty, the implementation may decide to export statistics for all available languages. Must not benull.metrics- ACollectionofMetricobjects defining the specific statistical measurements to be included in the export. If empty, the implementation may decide to include all available metrics. Must not benull.- Throws:
IOException- if an I/O error occurs during the export process. Implementations should ensure to handle such exceptions appropriately.
-