Interface Reporter
- All Known Implementing Classes:
AbstractReporter
,Reporter.NoOpImpl
,ReporterModel
Reporter
allows building up functional reports with a hierarchy reflecting task/subtasks of processes.
The enclosed reports are based on Report
class.
A Reporter
can create sub-reporters to separate from current reports the reports from that task.
Each sub-reporter is defined by a key identifying the corresponding task, a default String
describing
the corresponding task, and TypedValue
values indexed by their keys. These values may be referred to
by their key in the description of the sub-reporter, or in its reports, using the ${key}
syntax,
in order to be later replaced by StringSubstitutor
for instance when formatting
the string for the end user.
Instances of Reporter
are not thread-safe.
When a new thread is created, a new Reporter should be provided to the process in that thread.
A reporter 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.
The Reporter
can be used for multilingual support. Indeed, each Reporter
name and
Report
message can be translated based on their key and using the value keys in the desired order.
- Author:
- Florian Dupuy <florian.dupuy at rte-france.com>
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateSubReporter
(String taskKey, String defaultName) Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with no associated value.createSubReporter
(String taskKey, String defaultName, String key, Object value) Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated value.Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated typed value.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
Add a new reportvoid
Add a new report with no associated value.void
Add a new report with one associated value.void
Add a new report with one associated typed value.void
Add a new report with its associated values.
-
Field Details
-
NO_OP
A No-op implementation ofReporter
-
-
Method Details
-
createSubReporter
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
-
createSubReporter
Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with no associated value.- Parameters:
taskKey
- the key identifying that taskdefaultName
- a name or message describing the corresponding task- Returns:
- the new sub-reporter
-
createSubReporter
Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated value.- Parameters:
taskKey
- the key identifying that taskdefaultName
- a name or message describing the corresponding task, which may contain references to the provided valuekey
- the key for the value which followsvalue
- the value which may be referred to within the defaultName or within the reports message of the created sub-reporter- Returns:
- the new sub-reporter
-
createSubReporter
Reporter createSubReporter(String taskKey, String defaultName, String key, Object value, String type) Create a sub-reporter for a specific task, to separate from current reports the reports from that task, with one associated typed value.- Parameters:
taskKey
- the key identifying that taskdefaultName
- a name or message describing the corresponding task, which may contain references to the provided typed valuekey
- the key for the typed value which followsvalue
- the value which may be referred to within the defaultName or within the reports message of the created sub-reportertype
- the string representing the type of the value provided- Returns:
- the new sub-reporter
-
report
Add a new report with its associated values.- Parameters:
reportKey
- a key identifying the current reportdefaultMessage
- the default report message, which may contain references to the provided values or to the values of current reportervalues
- a map ofTypedValue
indexed by their key, which may be referred to within the defaultMessage provided
-
report
Add a new report with no associated value.- Parameters:
reportKey
- a key identifying the current reportdefaultMessage
- the default report message, which may contain references to the values of current reporter
-
report
Add a new report with one associated value.- Parameters:
reportKey
- a key identifying the current reportdefaultMessage
- the default report message, which may contain references to the provided value or to the values of current reportervalueKey
- the key for the value which followsvalue
- the int, long, float, double, boolean or String value which may be referred to within the defaultMessage provided
-
report
Add a new report with one associated typed value.- Parameters:
reportKey
- a key identifying the current reportdefaultMessage
- the default report message, which may contain references to the provided typed value or to the values of current reportervalueKey
- the key for the typed value which followsvalue
- the int, long, float, double, boolean or String value which may be referred to within the defaultMessage providedtype
- the string representing the type of the value provided
-
report
Add a new report- Parameters:
report
- the report to add
-