Package dev.restate.sdk.common.syscalls
Class Result<T>
java.lang.Object
dev.restate.sdk.common.syscalls.Result<T>
- Type Parameters:
T
- result type
Result can be 3 valued:
- Empty
- Value
- Failure
Failure in a ready result is always a user failure, and never a syscall failure, as opposed to
SyscallCallback.onCancel(Throwable)
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Result
<T> empty()
static <T> Result
<T> abstract @Nullable TerminalException
abstract @Nullable T
getValue()
abstract boolean
isEmpty()
abstract boolean
<U> Result
<U> mapSuccess
(Function<T, U> mapper) Map this result success value.static <T> Result
<T> success
(T value)
-
Method Details
-
isSuccess
public abstract boolean isSuccess()- Returns:
- true if there is no failure.
-
isEmpty
public abstract boolean isEmpty() -
getValue
- Returns:
- The success value, or null in case is empty.
-
getFailure
-
mapSuccess
Map this result success value. If the mapper throws an exception, this exception will be converted toTerminalException
and return a new failedResult
. -
empty
-
success
-
failure
-