Class ReporterModel

  • All Implemented Interfaces:
    Reporter

    public class ReporterModel
    extends AbstractReporter
    An in-memory implementation of Reporter.

    Being an implementation of Reporter, instances of ReporterModel are not thread-safe. A reporterModel is not meant to be shared with other threads nor to be saved as a class parameter, but should instead be passed on in methods through their arguments. Respecting this ensures that

    1. sub-reporters always are in the same order
    2. reports always are in the same order
    Author:
    Florian Dupuy
    • Constructor Detail

      • ReporterModel

        public ReporterModel​(String taskKey,
                             String defaultName)
        ReporterModel constructor, with no associated values.
        Parameters:
        taskKey - the key identifying the corresponding task
        defaultName - the name or message describing the corresponding task
      • ReporterModel

        public ReporterModel​(String taskKey,
                             String defaultName,
                             Map<String,​TypedValue> taskValues)
        ReporterModel constructor, with no associated values.
        Parameters:
        taskKey - the key identifying the corresponding task
        defaultName - the name or message describing the corresponding task, which may contain references to the provided values
        taskValues - a map of TypedValue indexed by their key, which may be referred to within the defaultName or within the reports message of created ReporterModel
    • Method Detail

      • createSubReporter

        public ReporterModel createSubReporter​(String taskKey,
                                               String defaultName,
                                               Map<String,​TypedValue> values)
        Description copied from interface: Reporter
        Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with some associated values.
        Parameters:
        taskKey - the key identifying that task
        defaultName - a name or message describing the corresponding task, which may contain references to the provided values
        values - a map of TypedValue indexed by their key, which may be referred to within the defaultName or within the reports message of the created sub-reporter
        Returns:
        the new sub-reporter
      • addSubReporter

        public void addSubReporter​(ReporterModel reporterModel)
        Add a reporterModel to the sub-reporters of current reporterModel.
        Parameters:
        reporterModel - the reporterModel to add
      • report

        public void report​(Report report)
        Description copied from interface: Reporter
        Add a new report
        Parameters:
        report - the report to add
      • getDefaultName

        public String getDefaultName()
      • getTaskKey

        public String getTaskKey()
      • export

        public void export​(Path path)
      • export

        public void export​(Writer writer)