T - E - @Immutable public final class Result<T,E extends Throwable> extends Object implements Immutable
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
E |
getExceptionIfPresent()
Returns the
Exception if occurred, otherwise null is returned. |
int |
hashCode() |
<E2 extends Throwable> |
ifFailure(Throwables.Consumer<? super E,E2> actionOnFailure) |
<E2 extends Throwable,E3 extends Throwable> |
ifFailureOrElse(Throwables.Consumer<? super E,E2> actionOnFailure,
Throwables.Consumer<? super T,E3> actionOnSuccess)
If failure or else.
|
<E2 extends Throwable> |
ifSuccess(Throwables.Consumer<? super T,E2> actionOnSuccess) |
<E2 extends Throwable,E3 extends Throwable> |
ifSuccessOrElse(Throwables.Consumer<? super T,E2> actionOnSuccess,
Throwables.Consumer<? super E,E3> actionOnFailure)
If success or else.
|
boolean |
isFailure()
Checks if is failure.
|
boolean |
isSuccess()
Checks if is success.
|
static <T,E extends Throwable> |
of(T value,
E exception) |
T |
orElse(T defaultValueIfErrorOccurred)
Deprecated.
replaced with
orElseIfFailure(Object) |
<E2 extends Throwable> |
orElseGet(Throwables.Supplier<? extends T,E2> otherIfErrorOccurred)
Deprecated.
|
<E2 extends Throwable> |
orElseGetIfFailure(Throwables.Supplier<? extends T,E2> otherIfErrorOccurred) |
T |
orElseIfFailure(T defaultValueIfErrorOccurred) |
T |
orElseThrow()
Or else throw.
|
<E2 extends Throwable> |
orElseThrow(E2 exception) |
<E2 extends Throwable> |
orElseThrow(Function<? super E,E2> exceptionSupplierIfErrorOccurred)
Or else throw.
|
<E2 extends Throwable> |
orElseThrow(Supplier<? extends E2> exceptionSupplier) |
Pair<T,E> |
toPair() |
String |
toString() |
Tuple.Tuple2<T,E> |
toTuple() |
public static <T,E extends Throwable> Result<T,E> of(T value, E exception)
T - E - value - exception - public boolean isFailure()
public boolean isSuccess()
public <E2 extends Throwable> void ifFailure(Throwables.Consumer<? super E,E2> actionOnFailure) throws E2 extends Throwable
E2 - actionOnFailure - E2 - the e2E2 extends Throwablepublic <E2 extends Throwable,E3 extends Throwable> void ifFailureOrElse(Throwables.Consumer<? super E,E2> actionOnFailure, Throwables.Consumer<? super T,E3> actionOnSuccess) throws E2 extends Throwable, E3 extends Throwable
E2 - E3 - actionOnFailure - actionOnSuccess - E2 - the e2E3 - the e3E2 extends Throwablepublic <E2 extends Throwable> void ifSuccess(Throwables.Consumer<? super T,E2> actionOnSuccess) throws E2 extends Throwable
E2 - actionOnSuccess - E2 - the e2E2 extends Throwablepublic <E2 extends Throwable,E3 extends Throwable> void ifSuccessOrElse(Throwables.Consumer<? super T,E2> actionOnSuccess, Throwables.Consumer<? super E,E3> actionOnFailure) throws E2 extends Throwable, E3 extends Throwable
E2 - E3 - actionOnSuccess - actionOnFailure - E2 - the e2E3 - the e3E2 extends Throwable@Deprecated public T orElse(T defaultValueIfErrorOccurred)
orElseIfFailure(Object)defaultValueIfErrorOccurred - @Deprecated public <E2 extends Throwable> T orElseGet(Throwables.Supplier<? extends T,E2> otherIfErrorOccurred) throws E2 extends Throwable
orElseGetIfFailure(com.landawn.abacus.util.Throwables.Supplier)E2 - otherIfErrorOccurred - E2E2 extends Throwablepublic T orElseIfFailure(T defaultValueIfErrorOccurred)
defaultValueIfErrorOccurred - public <E2 extends Throwable> T orElseGetIfFailure(Throwables.Supplier<? extends T,E2> otherIfErrorOccurred) throws E2 extends Throwable
E2 - otherIfErrorOccurred - E2E2 extends Throwablepublic <E2 extends Throwable> T orElseThrow(Function<? super E,E2> exceptionSupplierIfErrorOccurred) throws E2 extends Throwable
E2 - exceptionSupplierIfErrorOccurred - E2 - the e2E2 extends Throwablepublic <E2 extends Throwable> T orElseThrow(E2 exception) throws E2 extends Throwable
E2 - exception - E2E2 extends Throwablepublic <E2 extends Throwable> T orElseThrow(Supplier<? extends E2> exceptionSupplier) throws E2 extends Throwable
E2 - exceptionSupplier - E2E2 extends Throwablepublic E getExceptionIfPresent()
Exception if occurred, otherwise null is returned.public Tuple.Tuple2<T,E> toTuple()
public boolean equals(Object obj)
Copyright © 2021. All rights reserved.