Try<Success, Failure extends Exception> class
Methods
-
exceptionOrNull()
→ Failure?
-
Returns the encapsulated
Throwable
exception if this instance represents failure or null if it is success. */
-
flatMap<R>(Try<R, Failure> transform(Success value))
→ Try<R, Failure>
-
-
getOrElse(Success onFailure(Failure))
→ Success
-
-
getOrNull()
→ Success?
-
Returns the encapsulated value if this instance represents success or null if it is failure. */
-
getOrThrow()
→ Success
-
Returns the encapsulated value if this instance represents success
or throws the encapsulated Throwable exception if it is failure.
-
map<R>(R transform(Success value))
→ Try<R, Failure>
-
Returns the encapsulated result of the given transform function applied to the encapsulated value
if this instance represents success or the original encapsulated
Throwable
exception if it is failure.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
onFailure(void action(Failure))
→ Try<Success, Failure>
-
Performs the given action on the encapsulated
Throwable
exception if this instance represents failure.
Returns the original Try unchanged.
-
onSuccess(void action(Success))
→ Try<Success, Failure>
-
Performs the given action on the encapsulated value if this instance represents success.
Returns the original Try unchanged.
-
toString()
→ String
-
A string representation of this object.
override