Interface Reporter
-
- All Known Implementing Classes:
AbstractReporter
,Reporter.NoOpImpl
,ReporterModel
public interface Reporter
AReporter
allows building up functional reports with a hierarchy reflecting task/subtasks of processes. The enclosed reports are based onReport
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 defaultString
describing the corresponding task, andTypedValue
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 byStringSubstitutor
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, eachReporter
name andReport
message can be translated based on their key and using the value keys in the desired order.- Author:
- Florian Dupuy
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Reporter.NoOpImpl
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Reporter
createSubReporter(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.Reporter
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.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.Reporter
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
report(Report report)
Add a new reportvoid
report(String reportKey, String defaultMessage)
Add a new report with no associated value.void
report(String reportKey, String defaultMessage, String valueKey, Object value)
Add a new report with one associated value.void
report(String reportKey, String defaultMessage, String valueKey, Object value, String type)
Add a new report with one associated typed value.void
report(String reportKey, String defaultMessage, Map<String,TypedValue> values)
Add a new report with its associated values.
-
-
-
Field Detail
-
NO_OP
static final Reporter NO_OP
A No-op implementation ofReporter
-
-
Method Detail
-
createSubReporter
Reporter 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.- 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
Reporter createSubReporter(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.- Parameters:
taskKey
- the key identifying that taskdefaultName
- a name or message describing the corresponding task- Returns:
- the new sub-reporter
-
createSubReporter
Reporter 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.- 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
void report(String reportKey, String defaultMessage, Map<String,TypedValue> values)
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
void report(String reportKey, String defaultMessage)
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
void report(String reportKey, String defaultMessage, String valueKey, Object value)
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
void report(String reportKey, String defaultMessage, String valueKey, Object value, String type)
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
void report(Report report)
Add a new report- Parameters:
report
- the report to add
-
-