Package com.powsybl.commons.reporter
Class ReporterModel
- java.lang.Object
-
- com.powsybl.commons.reporter.AbstractReporter
-
- com.powsybl.commons.reporter.ReporterModel
-
- All Implemented Interfaces:
Reporter
public class ReporterModel extends AbstractReporter
An in-memory implementation ofReporter
.Being an implementation of
Reporter
, instances ofReporterModel
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- sub-reporters always are in the same order
- reports always are in the same order
- Author:
- Florian Dupuy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.powsybl.commons.reporter.Reporter
Reporter.NoOpImpl
-
-
Field Summary
-
Fields inherited from class com.powsybl.commons.reporter.AbstractReporter
defaultName, taskKey, taskValues
-
-
Constructor Summary
Constructors Constructor Description ReporterModel(String taskKey, String defaultName)
ReporterModel constructor, with no associated values.ReporterModel(String taskKey, String defaultName, Map<String,TypedValue> taskValues)
ReporterModel constructor, with no associated values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubReporter(ReporterModel reporterModel)
Add a reporterModel to the sub-reporters of current reporterModel.ReporterModel
createSubReporter(String taskKey, String defaultName, Map<String,TypedValue> values)
Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with some associated values.void
export(Writer writer)
void
export(Path path)
String
getDefaultName()
Collection<Report>
getReports()
List<ReporterModel>
getSubReporters()
String
getTaskKey()
Map<String,TypedValue>
getTaskValues()
static ReporterModel
parseJsonNode(com.fasterxml.jackson.databind.JsonNode reportTree, Map<String,String> dictionary, com.fasterxml.jackson.core.ObjectCodec codec)
void
report(Report report)
Add a new report-
Methods inherited from class com.powsybl.commons.reporter.AbstractReporter
createSubReporter, createSubReporter, createSubReporter, formatMessage, formatReportMessage, report, report, report, report
-
-
-
-
Constructor Detail
-
ReporterModel
public ReporterModel(String taskKey, String defaultName)
ReporterModel constructor, with no associated values.- Parameters:
taskKey
- the key identifying the corresponding taskdefaultName
- 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 taskdefaultName
- the name or message describing the corresponding task, which may contain references to the provided valuestaskValues
- a map ofTypedValue
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 taskdefaultName
- a name or message describing the corresponding task, which may contain references to the provided valuesvalues
- a map ofTypedValue
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
-
getReports
public Collection<Report> getReports()
-
getDefaultName
public String getDefaultName()
-
getTaskKey
public String getTaskKey()
-
getTaskValues
public Map<String,TypedValue> getTaskValues()
-
getSubReporters
public List<ReporterModel> getSubReporters()
-
export
public void export(Path path)
-
export
public void export(Writer writer)
-
parseJsonNode
public static ReporterModel parseJsonNode(com.fasterxml.jackson.databind.JsonNode reportTree, Map<String,String> dictionary, com.fasterxml.jackson.core.ObjectCodec codec) throws IOException
- Throws:
IOException
-
-