Skip to content

Package io.github.qishr.cascara.common.diagnostic

Class Diagnostic

java.lang.Object
        io.github.qishr.cascara.common.diagnostic.Diagnostic


public class Diagnostic

Represents a discrete event, log entry, or syntax/semantic problem identified during system runtime or source compilation.Each diagnostic encapsulates precise positioning boundaries, metadata strings, structural tracking indicators like thread name and execution timestamps, and an optional underlying exception cause.

Field Summary

Modifier and Type Field Description
public static final int UNKNOWN_COORD

Constructor Summary

Constructor Description
Diagnostic(URI uri, int line, int column, int startOffset, int endOffset, String source, Level level, StackTraceElement[] stackTrace, Throwable cause, DiagnosticMessage message, String format, Object[] details) Constructs a fully qualified Diagnostic entry with absolute location indicators.
Diagnostic(URI uri, Token token, String source, Level level, StackTraceElement[] stackTrace, Throwable cause, DiagnosticMessage message, String format, Object[] details) Constructs a Diagnostic entry by resolving positioning metadata directly from a parsing Token.

Method Summary

Modifier and Type Method Description
public URI getUri() Returns the URI of the source resource associated with this diagnostic.
public int getLine() Returns the 1-based line number of this diagnostic.
public int getColumn() Returns the 1-based column number of this diagnostic.
public int getStartOffset() Returns the 0-based absolute starting character offset of this diagnostic.
public int getEndOffset() Returns the 0-based absolute ending character offset (exclusive) of this diagnostic.
public String getSource() Returns the identifier string of the subsystem that produced this diagnostic.
public Level getLevel() Returns the severity Level classification of this diagnostic.
public StackTraceElement[] getStackTrace()
public DiagnosticMessage getMessage() Returns the stable classification code, suitable for localization and system filtering.
public String getFormattedMessage() Returns the formatted descriptive text message of this diagnostic.
public Object[] getDetails() Returns the arguments for the message format placeholders.
public Throwable getCause() Returns the underlying exception that caused this diagnostic, or null if none was provided.
public String getThread() Returns the name of the execution thread that instantiated this diagnostic instance.
public long getProcessId()
public Instant getTimestamp() Returns the exact timestamp indicating when this diagnostic was instantiated.
public void setUri(URI uri) Sets the URI of the source resource associated with this diagnostic.
public void setLine(int line) Sets the URI of the source resource associated with this diagnostic.

Field Details

UNKNOWN_COORD

public static final int UNKNOWN_COORD

See Also:

Constant Field Values


Method Details

getUri

public URI getUri()

Returns the URI of the source resource associated with this diagnostic.


getLine

public int getLine()

Returns the 1-based line number of this diagnostic.


getColumn

public int getColumn()

Returns the 1-based column number of this diagnostic.


getStartOffset

public int getStartOffset()

Returns the 0-based absolute starting character offset of this diagnostic.


getEndOffset

public int getEndOffset()

Returns the 0-based absolute ending character offset (exclusive) of this diagnostic.


getSource

public String getSource()

Returns the identifier string of the subsystem that produced this diagnostic.This is usually the FQCN of the class creating the diagnostic report.


getLevel

public Level getLevel()

Returns the severity Level classification of this diagnostic.


getStackTrace

public StackTraceElement[] getStackTrace()


getMessage

public DiagnosticMessage getMessage()

Returns the stable classification code, suitable for localization and system filtering.


getFormattedMessage

public String getFormattedMessage()

Returns the formatted descriptive text message of this diagnostic.


getDetails

public Object[] getDetails()

Returns the arguments for the message format placeholders.


getCause

public Throwable getCause()

Returns the underlying exception that caused this diagnostic, or null if none was provided.


getThread

public String getThread()

Returns the name of the execution thread that instantiated this diagnostic instance.


getProcessId

public long getProcessId()


getTimestamp

public Instant getTimestamp()

Returns the exact timestamp indicating when this diagnostic was instantiated.


setUri

public void setUri(URI uri)

Sets the URI of the source resource associated with this diagnostic.


setLine

public void setLine(int line)

Sets the URI of the source resource associated with this diagnostic.