Class BasicDiagnostic

java.lang.Object
org.eclipse.emf.common.util.BasicDiagnostic
All Implemented Interfaces:
Diagnostic, DiagnosticChain

public class BasicDiagnostic extends Object implements Diagnostic, DiagnosticChain
A basic implementation of a diagnostic that that also acts as a chain.
  • Field Details

  • Constructor Details

    • BasicDiagnostic

      public BasicDiagnostic()
      Default Constructor (no initialization for local parameters)
    • BasicDiagnostic

      public BasicDiagnostic(String source, int code, String message, Object[] data)
    • BasicDiagnostic

      public BasicDiagnostic(int severity, String source, int code, String message, Object[] data)
    • BasicDiagnostic

      public BasicDiagnostic(String source, int code, List<? extends Diagnostic> children, String message, Object[] data)
  • Method Details

    • dataAsList

      protected List<?> dataAsList(Object[] data)
    • setSeverity

      protected void setSeverity(int severity)
    • getSeverity

      public int getSeverity()
      Description copied from interface: Diagnostic
      Returns an indicator of the severity of the problem.
      Specified by:
      getSeverity in interface Diagnostic
    • getMessage

      public String getMessage()
      Description copied from interface: Diagnostic
      Returns a message describing the situation.
      Specified by:
      getMessage in interface Diagnostic
    • getData

      public List<?> getData()
      Description copied from interface: Diagnostic
      Returns 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:
      getData in interface Diagnostic
    • getChildren

      public List<Diagnostic> getChildren()
      Description copied from interface: Diagnostic
      Returns the list of child diagnostics.
      Specified by:
      getChildren in interface Diagnostic
    • setSource

      protected void setSource(String source)
    • getSource

      public String getSource()
      Description copied from interface: Diagnostic
      Returns the unique identifier of the source.
      Specified by:
      getSource in interface Diagnostic
    • setCode

      protected void setCode(int code)
    • getCode

      public int getCode()
      Description copied from interface: Diagnostic
      Returns source-specific identity code.
      Specified by:
      getCode in interface Diagnostic
    • add

      public void add(Diagnostic diagnostic)
      Description copied from interface: DiagnosticChain
      Adds the diagnostic to the chain.
      Specified by:
      add in interface DiagnosticChain
    • addAll

      public void addAll(Diagnostic diagnostic)
      Description copied from interface: DiagnosticChain
      Adds the children of the diagnostic to the chain.
      Specified by:
      addAll in interface DiagnosticChain
    • merge

      public void merge(Diagnostic diagnostic)
      Description copied from interface: DiagnosticChain
      If the diagnostic has children, adds those children, otherwise, adds the diagnostic.
      Specified by:
      merge in interface DiagnosticChain
    • recomputeSeverity

      public int recomputeSeverity()
    • getException

      public Throwable getException()
      Returns the first throwable object available in the data list, which is set when this diagnostic is instantiated.
      Specified by:
      getException in interface Diagnostic
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toIStatus

      public static org.eclipse.core.runtime.IStatus toIStatus(Diagnostic diagnostic)
      Returns the diagnostic viewed as an IStatus.
    • toIStatus

      public static org.eclipse.core.runtime.IStatus toIStatus(DiagnosticException diagnosticException)
      Returns the diagnostic exception viewed as an IStatus.
    • toDiagnostic

      public static Diagnostic toDiagnostic(org.eclipse.core.runtime.IStatus status)
    • toDiagnostic

      public static Diagnostic toDiagnostic(Throwable throwable)
      Returns the throwable viewed as a Diagnostic.
      Returns:
      Diagnostic