java.io.Serializablepublic final class OptionalThrowable
extends java.lang.Object
implements java.io.Serializable
Throwable.| Constructor | Description |
|---|---|
OptionalThrowable() |
Constructs an
OptionalThrowable containing no Throwable. |
OptionalThrowable(java.lang.Throwable exception) |
Constructs an
OptionalThrowable containing a Throwable. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object o) |
|
java.lang.Throwable |
get() |
Returns the
Throwable contained in this OptionalThrowable if defined, else throws IllegalStateException. |
int |
hashCode() |
|
boolean |
isDefined() |
Indicates whether this
OptionalThrowable is "defined," i.e., contains a Throwable. |
boolean |
isEmpty() |
Indicates whether this
OptionalThrowable is "empty," i.e., contains no Throwable. |
java.lang.String |
toString() |
public OptionalThrowable(java.lang.Throwable exception)
OptionalThrowable containing a Throwable.public OptionalThrowable()
OptionalThrowable containing no Throwable.public boolean isDefined()
OptionalThrowable is "defined," i.e., contains a Throwable.OptionalThrowable contains a Throwablepublic boolean isEmpty()
OptionalThrowable is "empty," i.e., contains no Throwable.OptionalThrowable contains no Throwablepublic java.lang.Throwable get()
Throwable contained in this OptionalThrowable if defined, else throws IllegalStateException.
To avoid the IllegalStateException, ensure isDefined returns true before calling this method.
Throwable, if this OptionalThrowable is definedjava.lang.IllegalStateException - if this OptionalThrowable is not defined.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object