Record Class Diagnostic
java.lang.Object
java.lang.Record
com.ultikits.ultitools.exceptions.Diagnostic
- Record Components:
code- the error code for this occurrencewhatHappened- the caller's description of the failure, including the concrete subjects (such as the affected class and field) when applicable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ErrorCodeThe field for thecoderecord component.private static final intprivate static final Stringprivate final StringThe field for thewhatHappenedrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDiagnostic(ErrorCode code, String whatHappened) Creates an instance of aDiagnosticrecord class. -
Method Summary
Modifier and TypeMethodDescriptionasContainerException(Throwable cause) Creates the existing typed exception without changing its cause chain.private static @Nullable Throwablecode()Returns the value of thecoderecord component.static StringcompactStackHeading(Throwable failure) Formats a stack heading after the surrounding report has already included the guidance.private static Stringstatic @Nullable StringdescriptionOf(Throwable failure) Returns the occurrence text, without embedding the fix and reference in another heading.final booleanIndicates whether some other object is "equal to" this one.private static StringfailureName(Throwable failure) static Optional<Diagnostic> Looks through wrappers for a more specific failure.static Optional<Diagnostic> Recognises a coded cause, but gives a failed direct class lookup the caller's code.static DiagnosticforPostConstruct(String beanName, Class<?> declaringClass, String method, Throwable cause) Names the failing lifecycle callback independently of the code selected from its cause.static DiagnosticSelects a specific framework code through exception wrappers, including reflective invocation.static DiagnosticfromFailure(ErrorCode fallback, String context, Throwable failure) Adds context to a failure without repeating the cause's fix and documentation lines.private static Stringfinal inthashCode()Returns a hash code value for this object.headline()Renders this occurrence without its fix and documentation lines.private static intlastCompactFrame(List<Diagnostic.LogFrame> frames, int owner) voidLogs the selected guidance exactly once.private static @Nullable Stringstatic ThrowableoriginalFailure(Throwable failure) Returns the original exception for consumers that use the exception's type and identity.(package private) static Stringprivate static ThrowableprojectLogPrefix(List<Diagnostic.LogFrame> frames, int owner, int lastCompact, @Nullable Throwable tail) static @Nullable DiagnosticreadRendered(@Nullable String message) Recognizes only a complete diagnostic, not a code or a guidance label mentioned in prose.render()Renders this occurrence with the documentation page's location inside the UltiTools-API JAR.final StringtoString()Returns a string representation of this record class.private static ThrowableunwrapInvocation(Throwable failure) Returns the value of thewhatHappenedrecord component.
-
Field Details
-
code
-
whatHappened
The field for thewhatHappenedrecord component. -
MAX_CAUSE_DEPTH
private static final int MAX_CAUSE_DEPTH- See Also:
-
POST_CONSTRUCT_FAILURE
- See Also:
-
-
Constructor Details
-
Diagnostic
Creates an instance of aDiagnosticrecord class.- Parameters:
code- the value for thecoderecord componentwhatHappened- the value for thewhatHappenedrecord component
-
-
Method Details
-
fromCause
Selects a specific framework code through exception wrappers, including reflective invocation. -
forPostConstruct
public static Diagnostic forPostConstruct(String beanName, Class<?> declaringClass, String method, Throwable cause) Names the failing lifecycle callback independently of the code selected from its cause. -
asContainerException
Creates the existing typed exception without changing its cause chain. -
prefix
-
render
Renders this occurrence with the documentation page's location inside the UltiTools-API JAR.- Returns:
- the three-part diagnostic
-
headline
Renders this occurrence without its fix and documentation lines. -
log
Logs the selected guidance exactly once. If a cause already carries the selected code's guidance, the record adds only context. Other rendered causes retain their text and frames but not a second fix or documentation link. No exception received by callers is rewritten. -
lastCompactFrame
-
projectLogPrefix
private static Throwable projectLogPrefix(List<Diagnostic.LogFrame> frames, int owner, int lastCompact, @Nullable @Nullable Throwable tail) -
originalFailure
-
compactStackHeading
-
failureName
-
descriptionOf
-
fromFailure
Adds context to a failure without repeating the cause's fix and documentation lines. -
findIn
Recognises a coded cause, but gives a failed direct class lookup the caller's code. A linkage failure for a referenced class keeps its dependency code instead. -
findIn
Looks through wrappers for a more specific failure. Framework exceptions carry their code explicitly. The bootstrap and class-loader boundaries must keep their exact JDK exception types, so there we recognise only a complete diagnostic, not a code mentioned in prose. -
readRendered
Recognizes only a complete diagnostic, not a code or a guidance label mentioned in prose. -
unwrapInvocation
-
causeOf
-
describe
-
messageOf
-
guidance
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
code
-
whatHappened
Returns the value of thewhatHappenedrecord component.- Returns:
- the value of the
whatHappenedrecord component
-