Package org.kiwiproject.base
Class KiwiThrowables.ThrowableInfo
java.lang.Object
org.kiwiproject.base.KiwiThrowables.ThrowableInfo
- Enclosing class:
- KiwiThrowables
Immutable "struct" that contains information from a
Throwable instance.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetCause()getType()booleanhasCause()booleanbooleanUse this method to check whether this instance was created from a null Throwable object.static KiwiThrowables.ThrowableInfoFactory method.
-
Field Details
-
type
-
message
-
stackTrace
-
cause
-
-
Method Details
-
of
Factory method. Ifthrowableis null, the returned instance will contain all null values, andisEmptyInstance()will return true.- Parameters:
throwable- original throwable, possibly null- Returns:
- constructed instance
-
isEmptyInstance
public boolean isEmptyInstance()Use this method to check whether this instance was created from a null Throwable object.- Returns:
- true to indicate that this instance was created from a null Throwable; otherwise false
-
hasMessage
public boolean hasMessage()- Returns:
- true if the Throwable this instance came from was not null and contained a message, otherwise false
-
hasCause
public boolean hasCause()- Returns:
- true if the Throwable this instance came from was not null and had a cause, otherwise false
-
getType
- Returns:
- an Optional containing the type of Throwable this instance came from, or an empty Optional
-
getMessage
- Returns:
- an Optional containing the message from the Throwable this instance came from, or an empty Optional
-
getStackTrace
- Returns:
- an Optional containing the stack trace of the Throwable this instance came from, or an empty Optional
-
getCause
- Returns:
- an Optional containing the cause from the Throwable this instance came from, or an empty Optional if the original Throwable did not have a cause or this instance came from a null Throwable
-