Package panda.std
Class Result<VALUE,ERROR>
java.lang.Object
panda.std.Result<VALUE,ERROR>
- Type Parameters:
VALUE- type of valueERROR- type of error
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Method Summary
Modifier and TypeMethodDescriptionattempt(@NotNull Class<? extends ERROR> exceptionType, @NotNull ThrowingSupplier<VALUE, @NotNull ERROR> supplier) Deprecated.attempt(@NotNull ThrowingSupplier<VALUE, @NotNull Exception> supplier) Deprecated.booleanerror()static <VALUE,ERROR>
@NotNull Result<VALUE,ERROR> error(ERROR err) <E extends Exception>
@NotNull Result.FilteredResult<VALUE,E, ERROR> filterWithThrowing(@NotNull ThrowingConsumer<VALUE, @NotNull E> filtersBody) flatMapErr(@NotNull Function<@NotNull ERROR, @NotNull Result<VALUE, MAPPED_ERROR>> function) <COMMON> COMMONget()getAny()<AS> ASgetAnyAs()getError()getState()inthashCode()booleanisErr()booleanisOk()booleanmerge(@NotNull Result<SECOND_VALUE, ? extends ERROR> second, @NotNull BiFunction<VALUE, SECOND_VALUE, R> mergeFunction) ok()static <VALUE,ERROR>
@NotNull Result<VALUE,ERROR> ok(VALUE value) orElseThrow(@NotNull ThrowingFunction<ERROR, E, E> consumer) Deprecated.orNull()orThrow(@NotNull ThrowingFunction<ERROR, E, E> consumer) <REQUIRED_VALUE,REQUIRED_ERROR>
@NotNull Result<REQUIRED_VALUE,REQUIRED_ERROR> project()runThrowing(@NotNull Class<? extends ERROR> exceptionType, @NotNull ThrowingRunnable<@NotNull ERROR> runnable) runThrowing(@NotNull ThrowingRunnable<@NotNull Exception> runnable) supplyThrowing(@NotNull Class<? extends ERROR> exceptionType, @NotNull ThrowingSupplier<VALUE, @NotNull ERROR> supplier) supplyThrowing(@NotNull ThrowingSupplier<VALUE, @NotNull Exception> supplier) swap()toOption()toString()static <VALUE,ERROR>
@NotNull Result<VALUE,ERROR> static <VALUE,ERROR>
@NotNull Result<VALUE,ERROR> when(boolean condition, VALUE value, ERROR err)
-
Method Details
-
ok
-
ok
-
error
-
error
-
when
-
when
@NotNull public static <VALUE,ERROR> @NotNull Result<VALUE,ERROR> when(boolean condition, VALUE value, ERROR err) -
runThrowing
@NotNull public static <ERROR extends Exception> @NotNull Result<Void,@NotNull Exception> runThrowing(@NotNull @NotNull ThrowingRunnable<@NotNull Exception> runnable) throws AttemptFailedException - Throws:
AttemptFailedException
-
runThrowing
@NotNull public static <ERROR extends Throwable> @NotNull Result<Void,ERROR> runThrowing(@NotNull @NotNull Class<? extends ERROR> exceptionType, @NotNull @NotNull ThrowingRunnable<@NotNull ERROR> runnable) throws AttemptFailedException - Throws:
AttemptFailedException
-
attempt
@Deprecated @NotNull public static <VALUE> @NotNull Result<VALUE,Exception> attempt(@NotNull @NotNull ThrowingSupplier<VALUE, @NotNull Exception> supplier) Deprecated. -
attempt
@Deprecated @NotNull public static <VALUE,ERROR extends Throwable> @NotNull Result<VALUE,ERROR> attempt(@NotNull @NotNull Class<? extends ERROR> exceptionType, @NotNull @NotNull ThrowingSupplier<VALUE, @NotNull ERROR> supplier) throws AttemptFailedExceptionDeprecated. -
supplyThrowing
@NotNull public static <VALUE> @NotNull Result<VALUE,Exception> supplyThrowing(@NotNull @NotNull ThrowingSupplier<VALUE, @NotNull Exception> supplier) -
supplyThrowing
@NotNull public static <VALUE,ERROR extends Throwable> @NotNull Result<VALUE,ERROR> supplyThrowing(@NotNull @NotNull Class<? extends ERROR> exceptionType, @NotNull @NotNull ThrowingSupplier<VALUE, @NotNull ERROR> supplier) throws AttemptFailedException- Throws:
AttemptFailedException
-
merge
-
map
-
mapToBlank
-
mapErrToBlank
-
mapErr
-
flatMap
-
flatMapErr
-
filter
-
filterNot
-
filter
-
filterWithThrowing
@NotNull public <E extends Exception> @NotNull Result.FilteredResult<VALUE,E, filterWithThrowingERROR> (@NotNull @NotNull ThrowingConsumer<VALUE, @NotNull E> filtersBody) -
fold
-
matches
-
is
-
swap
-
consume
-
project
@NotNull public <REQUIRED_VALUE,REQUIRED_ERROR> @NotNull Result<REQUIRED_VALUE,REQUIRED_ERROR> project() -
projectToValue
-
projectToError
-
orElse
-
orElseGet
-
orThrow
@NotNull public <E extends Exception> VALUE orThrow(@NotNull @NotNull ThrowingFunction<ERROR, E, throws EE> consumer) - Throws:
E extends Exception
-
orElseThrow
@Deprecated @NotNull public <E extends Exception> VALUE orElseThrow(@NotNull @NotNull ThrowingFunction<ERROR, E, throws EE> consumer) Deprecated.- Throws:
E extends Exception- See Also:
-
peek
-
onError
-
isOk
public boolean isOk() -
isErr
public boolean isErr() -
get
-
getError
-
getAny
-
getAnyAs
public <AS> AS getAnyAs() -
toOption
-
errorToOption
-
orNull
-
getState
-
equals
-
hashCode
public int hashCode() -
toString
-