public final class OptionalThrowable
extends java.lang.Object
implements java.io.Serializable
Throwable
.Constructor and Description |
---|
OptionalThrowable()
Constructs an
OptionalThrowable containing no Throwable . |
OptionalThrowable(java.lang.Throwable exception)
Constructs an
OptionalThrowable containing a Throwable . |
Modifier and Type | Method and 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 Throwable
public boolean isEmpty()
OptionalThrowable
is "empty," i.e., contains no Throwable
.OptionalThrowable
contains no Throwable
public 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.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object