Class RxTry
java.lang.Object
io.github.venkateshamurthy.exceptional.RxTry
A convenience set of utility methods making use of Try methods for callable, runnables etc
- Author:
- venkateshamurthy.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<X extends Exception,R>
io.vavr.control.Try<R> consumeFailure(io.vavr.control.Try<R> tryer, Class<X> ex, Consumer<X> op) Consume Failures while executingTryconsumeFailure(io.vavr.control.Try<R> tryer, Class<X1> ex, Consumer<X1> op, Class<X2> ex2, Consumer<X2> op2) Consume Failures while executingTryconsumeFailure(io.vavr.control.Try<R> tryer, Class<X1> ex, Consumer<X1> op, Class<X2> ex2, Consumer<X2> op2, Class<X3> ex3, Consumer<X3> op3) Consume Failures while executingTry<X extends Exception,R>
io.vavr.control.Try<R> mapException(io.vavr.control.Try<R> tryer, Class<X> ex, Supplier<? extends Exception> op) Map/Trnsform Failures to desired exception while executingTry<X extends Exception,R>
io.vavr.control.Try<R> mapException(io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op) Map/Trnsform Failures to desired exception while executingTrymapException(io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op, Class<X2> ex2, UnaryOperator<Exception> op2) Map/Trnsform Failures to desired exception while executingTrymapException(io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op, Class<X2> ex2, UnaryOperator<Exception> op2, Class<X3> ex3, UnaryOperator<Exception> op3) Map/Trnsform Failures to desired exception while executingTry<T,T2, R> io.vavr.control.Try <R> tryWrap(io.github.resilience4j.core.functions.CheckedBiFunction<T, T2, R> checkedBiFunction, T t, T2 t2) WrappingCheckedBiFunctionwith aTry.<T,R> io.vavr.control.Try <R> tryWrap(io.github.resilience4j.core.functions.CheckedFunction<T, R> checkedFunction, T t) WrappingCheckedFunctionwith aTry.io.vavr.control.Try<Void> tryWrap(io.github.resilience4j.core.functions.CheckedRunnable runnable) WrappingCheckedRunnablewith qTry<R> io.vavr.control.Try<R> tryWrap(io.github.resilience4j.core.functions.CheckedSupplier<R> checkedSupplier) WrappingCheckedSupplierwith aTryio.vavr.control.Try<Void> WrappingRunnablewith qTry<R> io.vavr.control.Try<R> WrappingCallablewith aTry<T,T2, R> io.vavr.control.Try <R> tryWrap(BiFunction<T, T2, R> biFunction, T t, T2 t2) WrappingBiFunctionwith aTry.<T,R> io.vavr.control.Try <R> WrappingFunctionwith aTry.<R> io.vavr.control.Try<R> WrappingSupplierwith aTry
-
Field Details
-
ceMapper
-
rteMapper
A common Runtime Exception Mapper.
-
-
Constructor Details
-
RxTry
public RxTry()
-
-
Method Details
-
consumeFailure
public <X1 extends Exception,X2 extends Exception, io.vavr.control.Try<R> consumeFailureX3 extends Exception, R> (io.vavr.control.Try<R> tryer, Class<X1> ex, Consumer<X1> op, Class<X2> ex2, Consumer<X2> op2, Class<X3> ex3, Consumer<X3> op3) Consume Failures while executingTry- Type Parameters:
X1- Exception typeX2- Exception type 2ndX3- Exception type 3rdR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Consumer that silently accepts the exceptionex2- Class<Exception> that can be encounteredop2- Consumer that silently accepts the exceptionex3- Class<Exception> that can be encounteredop3- Consumer that silently accepts the exceptionr- Returns:
- Try
-
consumeFailure
public <X1 extends Exception,X2 extends Exception, io.vavr.control.Try<R> consumeFailureR> (io.vavr.control.Try<R> tryer, Class<X1> ex, Consumer<X1> op, Class<X2> ex2, Consumer<X2> op2) Consume Failures while executingTry- Type Parameters:
X1- Exception typeX2- Exception type 2ndR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Consumer that silently accepts the exceptionex2- Class<Exception> that can be encounteredop2- Consumer that silently accepts the exception- Returns:
- Try
-
consumeFailure
public <X extends Exception,R> io.vavr.control.Try<R> consumeFailure(io.vavr.control.Try<R> tryer, Class<X> ex, Consumer<X> op) Consume Failures while executingTry- Type Parameters:
X- Exception typeR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Consumer that silently accepts the exception- Returns:
- Try
-
mapException
public <X extends Exception,R> io.vavr.control.Try<R> mapException(io.vavr.control.Try<R> tryer, Class<X> ex, Supplier<? extends Exception> op) Map/Trnsform Failures to desired exception while executingTry- Type Parameters:
X- Exception typeR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Supplier of a new/different exception in lieu of exception encountered- Returns:
- Try
-
mapException
public <X extends Exception,R> io.vavr.control.Try<R> mapException(io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op) Map/Trnsform Failures to desired exception while executingTry- Type Parameters:
X- Exception typeR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Transform for the exception to be mapped to another- Returns:
- Try
-
mapException
public <X extends Exception,X2 extends Exception, io.vavr.control.Try<R> mapExceptionR> (io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op, Class<X2> ex2, UnaryOperator<Exception> op2) Map/Trnsform Failures to desired exception while executingTry- Type Parameters:
X- Exception typeX2- Exception type 2ndR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Transform for the exception to be mapped to anotherex2- Class<Exception> that can be encounteredop2- Transform for the exception to be mapped to another- Returns:
- Try
-
mapException
public <X extends Exception,X2 extends Exception, io.vavr.control.Try<R> mapExceptionX3 extends Exception, R> (io.vavr.control.Try<R> tryer, Class<X> ex, UnaryOperator<Exception> op, Class<X2> ex2, UnaryOperator<Exception> op2, Class<X3> ex3, UnaryOperator<Exception> op3) Map/Trnsform Failures to desired exception while executingTry- Type Parameters:
X- Exception typeX2- Exception type 2ndX3- Exception type 3rdR- Return type- Parameters:
tryer- ATryto be augmented with exception consumerex- Class<Exception> that can be encounteredop- Transform for the exception to be mapped to anotherex2- Class<Exception> that can be encounteredop2- Transform for the exception to be mapped to anotherex3- Class<Exception> that can be encounteredop3- Transform for the exception to be mapped to another- Returns:
- Try
-
tryWrap
public <T,T2, io.vavr.control.Try<R> tryWrapR> (io.github.resilience4j.core.functions.CheckedBiFunction<T, T2, R> checkedBiFunction, T t, T2 t2) WrappingCheckedBiFunctionwith aTry.- Type Parameters:
T- first input typeT2- second input typeR- result- Parameters:
checkedBiFunction- theCheckedBiFunctiont- first input argumentt2- second input argument- Returns:
- Try
-
tryWrap
WrappingBiFunctionwith aTry.- Type Parameters:
T- first input typeT2- second input typeR- result- Parameters:
biFunction- theBiFunctiont- first input argumentt2- second input argument- Returns:
- Try
-
tryWrap
public <T,R> io.vavr.control.Try<R> tryWrap(io.github.resilience4j.core.functions.CheckedFunction<T, R> checkedFunction, T t) WrappingCheckedFunctionwith aTry.- Type Parameters:
T- first input typeR- result- Parameters:
checkedFunction- theCheckedFunctiont- first input argument- Returns:
- Try
-
tryWrap
-
tryWrap
-
tryWrap
public <R> io.vavr.control.Try<R> tryWrap(io.github.resilience4j.core.functions.CheckedSupplier<R> checkedSupplier) WrappingCheckedSupplierwith aTry- Type Parameters:
R- type of result- Parameters:
checkedSupplier- to be wrapped- Returns:
- Try wrapping checkedSupplier
-
tryWrap
-
tryWrap
-
tryWrap
public io.vavr.control.Try<Void> tryWrap(io.github.resilience4j.core.functions.CheckedRunnable runnable) WrappingCheckedRunnablewith qTry- Parameters:
runnable- to be wrapped- Returns:
- Try wrapping runnable
-