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.
Constructor Summary
| Constructor | Description |
|---|---|
| Diagnostic(URI uri, int line, int column, int startOffset, int endOffset, String source, Level level, String code, String message, Throwable cause) | Constructs a fully qualified Diagnostic entry with absolute location indicators. |
| Diagnostic(URI uri, Token token, String source, Level level, String code, String message, Throwable cause) | 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 String | getCode() | Returns the stable classification code, suitable for localization and system filtering. |
| public String | getMessage() | Returns the formatted descriptive text message of this diagnostic. |
| 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 LocalDateTime | 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. |
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.
getLevel
public Level getLevel()
Returns the severity Level classification of this diagnostic.
getCode
public String getCode()
Returns the stable classification code, suitable for localization and system filtering.
getMessage
public String getMessage()
Returns the formatted descriptive text message of this diagnostic.
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.
getTimestamp
public LocalDateTime 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.