Package org.eclipse.emf.common.util
Class BasicDiagnostic
java.lang.Object
org.eclipse.emf.common.util.BasicDiagnostic
- All Implemented Interfaces:
Diagnostic,DiagnosticChain
A basic implementation of a diagnostic that that also acts as a chain.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<Diagnostic>The message.protected intThe code.protected List<?>The data.protected StringThe message.protected intThe severity.protected StringThe source.Fields inherited from interface org.eclipse.emf.common.util.Diagnostic
CANCEL, CANCEL_INSTANCE, ERROR, INFO, OK, OK_INSTANCE, WARNING -
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor (no initialization for local parameters)BasicDiagnostic(int severity, String source, int code, String message, Object[] data) BasicDiagnostic(String source, int code, String message, Object[] data) BasicDiagnostic(String source, int code, List<? extends Diagnostic> children, String message, Object[] data) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Diagnostic diagnostic) Adds the diagnostic to the chain.voidaddAll(Diagnostic diagnostic) Adds thechildrenof the diagnostic to the chain.protected List<?>dataAsList(Object[] data) Returns the list of childdiagnostics.intgetCode()Returnssource-specificidentity code.List<?>getData()Returns the arbitrary associated list of data.Returns the first throwable object available in thedatalist, which is set when this diagnostic is instantiated.Returns a message describing the situation.intReturns an indicator of the severity of the problem.Returns the unique identifier of the source.voidmerge(Diagnostic diagnostic) intprotected voidsetCode(int code) protected voidsetSeverity(int severity) protected voidstatic DiagnostictoDiagnostic(Throwable throwable) Returns the throwable viewed as aDiagnostic.static DiagnostictoDiagnostic(org.eclipse.core.runtime.IStatus status) static org.eclipse.core.runtime.IStatustoIStatus(Diagnostic diagnostic) Returns the diagnostic viewed as anIStatus.static org.eclipse.core.runtime.IStatustoIStatus(DiagnosticException diagnosticException) Returns the diagnostic exception viewed as anIStatus.toString()
-
Field Details
-
severity
protected int severityThe severity.- See Also:
-
message
The message.- See Also:
-
children
The message.- See Also:
-
data
The data.- See Also:
-
source
The source.- See Also:
-
code
protected int codeThe code.- See Also:
-
-
Constructor Details
-
BasicDiagnostic
public BasicDiagnostic()Default Constructor (no initialization for local parameters) -
BasicDiagnostic
-
BasicDiagnostic
-
BasicDiagnostic
public BasicDiagnostic(String source, int code, List<? extends Diagnostic> children, String message, Object[] data)
-
-
Method Details
-
dataAsList
-
setSeverity
protected void setSeverity(int severity) -
getSeverity
public int getSeverity()Description copied from interface:DiagnosticReturns an indicator of the severity of the problem.- Specified by:
getSeverityin interfaceDiagnostic
-
getMessage
Description copied from interface:DiagnosticReturns a message describing the situation.- Specified by:
getMessagein interfaceDiagnostic
-
getData
Description copied from interface:DiagnosticReturns the arbitrary associated list of data. The first element is typically the object that is the primary source of the problem; the second element is typically some object describing the problematic feature or aspect of the primary source, and the remaining elements are additional objects associated with or describing the problem.- Specified by:
getDatain interfaceDiagnostic
-
getChildren
Description copied from interface:DiagnosticReturns the list of childdiagnostics.- Specified by:
getChildrenin interfaceDiagnostic
-
setSource
-
getSource
Description copied from interface:DiagnosticReturns the unique identifier of the source.- Specified by:
getSourcein interfaceDiagnostic
-
setCode
protected void setCode(int code) -
getCode
public int getCode()Description copied from interface:DiagnosticReturnssource-specificidentity code.- Specified by:
getCodein interfaceDiagnostic
-
add
Description copied from interface:DiagnosticChainAdds the diagnostic to the chain.- Specified by:
addin interfaceDiagnosticChain
-
addAll
Description copied from interface:DiagnosticChainAdds thechildrenof the diagnostic to the chain.- Specified by:
addAllin interfaceDiagnosticChain
-
merge
Description copied from interface:DiagnosticChain- Specified by:
mergein interfaceDiagnosticChain
-
recomputeSeverity
public int recomputeSeverity() -
getException
Returns the first throwable object available in thedatalist, which is set when this diagnostic is instantiated.- Specified by:
getExceptionin interfaceDiagnostic
-
toString
-
toIStatus
Returns the diagnostic viewed as anIStatus. -
toIStatus
Returns the diagnostic exception viewed as anIStatus. -
toDiagnostic
-
toDiagnostic
Returns the throwable viewed as aDiagnostic.- Returns:
Diagnostic
-