Interface IInitializationReport
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
InitializationReport
,InitializationReportLogger
Base interface for classes that need to report errors or warnings.
- Since:
- 5.0
- Author:
- Jon van Leuven, O. Kerpershoek, F. van der Meer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addMessage
(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.void
addReport
(IInitializationReport other) int
beginScope
(Category category, ErrorCode code, String[] parameters) This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code.void
endScope
(int identificationKey) This method ends the scope of the initialisation report.int
This method returns the total number of messages that is present in the report.int
getMessageCount
(Severity severity) This method returns the number of messages with the requested severity.getMessages
(Severity severity) This method returns an array containing all the messages of the requested severity.This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.boolean
This method returns a boolean indicating if any messages have been added to the report.toXml()
This method returns an XML representation of the report.
-
Method Details
-
addMessage
This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context.- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.
-
addMessage
void addMessage(Category category, ErrorCode code, String[] parameters, Severity severity, Throwable cause) This method will add an initialisation error to the report for the specified error code and parameters, but may optionally choose to re-throw the initialisation error if it is deemed too severe in the current context. In addition a cause can be added in case of spurious errors.- Parameters:
category
- The category (component) where the message originated from.code
- Error code identifying the message.parameters
- array of parameters for the message.severity
- The severity of the message.cause
- The exception which causes the error which is added to the report.
-
beginScope
This method starts a new initialisation report scope, when error's are added during the time this scope is active initialisation messages are nested within an initialisation message of the given code. Using this structure gives the initialisation messages a tree like structure.- Parameters:
category
- The category (component) where the message/scope originated from.code
- The code of the initialisation message which is used only if an initialisation message is added.parameters
- array of parameters for the message.- Returns:
- A unique identifier which can be used to end the current scope.
-
endScope
void endScope(int identificationKey) This method ends the scope of the initialisation report.- Parameters:
identificationKey
- The unique id which was retrieved by the beginscope call.
-
getRootMessage
InitializationMessage getRootMessage()This message returns the first explaining message of the initialization report, possibly this message has children which results in a nesting tree of messages.- Returns:
- The root message of the initialisation report.
-
hasMessages
boolean hasMessages()This method returns a boolean indicating if any messages have been added to the report.- Returns:
- a boolean indicating if any messages have been added to the report.
-
getMessageCount
int getMessageCount()This method returns the total number of messages that is present in the report.- Returns:
- the total number of messages that is present in the report.
-
getMessageCount
This method returns the number of messages with the requested severity.- Parameters:
severity
- The severity of the requested message count.- Returns:
- the number of messages with the requested severity.
-
getMessages
This method returns an array containing all the messages of the requested severity. If no messages with the requested severity are found, an empty array is returned.- Parameters:
severity
- The severity of the requested messages.- Returns:
- an array containing all the messages of the requested severity.
-
toXml
IXmlElement toXml()This method returns an XML representation of the report.- Returns:
- an XML representation of the report.
-
addReport
-