public class ReportType
extends java.lang.Object
By convention, a report must be declared as a static field publicly accessible from the sender class.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
reportName |
Constructor and Description |
---|
ReportType(java.lang.String errorFormat)
Construct a new report type.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMessage(java.lang.Object[] parameters)
Convert the given report to a string, using the provided parameters.
|
static java.lang.String |
getReportName(java.lang.Object sender,
ReportType type)
Retrieve the full canonical name of a given report type.
|
static ReportType[] |
getReports(java.lang.Class<?> sender)
Retrieve all publicly associated reports.
|
static java.lang.Class<?> |
getSenderClass(java.lang.Object sender)
Retrieve the class of the given sender.
|
java.lang.String |
toString() |
public ReportType(java.lang.String errorFormat)
errorFormat
- - string used to format the underlying report.public java.lang.String getMessage(java.lang.Object[] parameters)
parameters
- - parameters to insert, or NULL to insert nothing.public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.Class<?> getSenderClass(java.lang.Object sender)
If the sender is already a Class, we return it.
sender
- - the sender to look up.public static java.lang.String getReportName(java.lang.Object sender, ReportType type)
Note that the sender may be a class (for static callers), in which case it will be used directly instead of its getClass() method.
It is thus not advisable for class classes to report reports.
sender
- - the sender, or its class.type
- - the report type.public static ReportType[] getReports(java.lang.Class<?> sender)
sender
- - sender class.