Top Constructors Methods
io.github.resilience4j.core

public Class CheckedFunctionUtils

extends Object
Class Inheritance
Imports
io.github.resilience4j.core.functions.CheckedBiFunction, .CheckedFunction, .CheckedSupplier, java.util.List, java.util.function.BiFunction, .Predicate

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
return type of callable
T
,
return type of handler
R
>
CheckedSupplier<R>

Returns:

a supplier composed of supplier and handler
andThen
(CheckedSupplier<T>
the supplier
supplier
,
CheckedBiFunction<T, Throwable, R>
the supplier applied after callable
handler
)

Returns a composed supplier that first applies the supplier and then applies BiFunction after to the result.

public static <
return type of after
T
>
CheckedSupplier<T>

Returns:

a supplier composed of callable and exceptionHandler
recover
(CheckedSupplier<T>
the supplier which should be recovered from a certain exception
supplier
,
CheckedFunction<Throwable, T>
the exception handler
exceptionHandler
)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

public static <
return type of after
T
>
CheckedSupplier<T>

Returns:

a supplier composed of supplier and exceptionHandler
recover
(CheckedSupplier<T>
the supplier
supplier
,
Predicate<T>
the result predicate
resultPredicate
,
CheckedFunction<T, T>
the result handler
resultHandler
)

Returns a composed supplier that first executes the supplier and optionally recovers from a specific result.

public static <
return type of after
T
>
CheckedSupplier<T>

Returns:

a supplier composed of supplier and exceptionHandler
recover
(CheckedSupplier<T>
the supplier which should be recovered from a certain exception
supplier
,
List<Class<? extends Throwable>>
the specific exception types that should be recovered
exceptionTypes
,
CheckedFunction<Throwable, T>
the exception handler
exceptionHandler
)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

public static <X extends Throwable,
return type of after
T
>
CheckedSupplier<T>

Returns:

a supplier composed of callable and exceptionHandler
recover
(CheckedSupplier<T>
the supplier which should be recovered from a certain exception
supplier
,
Class<X>
the specific exception type that should be recovered
exceptionType
,
CheckedFunction<Throwable, T>
the exception handler
exceptionHandler
)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CheckedFunctionUtilsback to summary
private CheckedFunctionUtils()

Method Detail

andThenback to summary
public static <T, R> CheckedSupplier<R> andThen(CheckedSupplier<T> supplier, CheckedBiFunction<T, Throwable, R> handler)

Returns a composed supplier that first applies the supplier and then applies BiFunction after to the result.

Parameters
<T>
return type of callable
<R>
return type of handler
supplier:CheckedSupplier<T>

the supplier

handler:CheckedBiFunction<T, Throwable, R>

the supplier applied after callable

Returns:CheckedSupplier<R>

a supplier composed of supplier and handler

recoverback to summary
public static <T> CheckedSupplier<T> recover(CheckedSupplier<T> supplier, CheckedFunction<Throwable, T> exceptionHandler)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

Parameters
<T>
return type of after
supplier:CheckedSupplier<T>

the supplier which should be recovered from a certain exception

exceptionHandler:CheckedFunction<Throwable, T>

the exception handler

Returns:CheckedSupplier<T>

a supplier composed of callable and exceptionHandler

recoverback to summary
public static <T> CheckedSupplier<T> recover(CheckedSupplier<T> supplier, Predicate<T> resultPredicate, CheckedFunction<T, T> resultHandler)

Returns a composed supplier that first executes the supplier and optionally recovers from a specific result.

Parameters
<T>
return type of after
supplier:CheckedSupplier<T>

the supplier

resultPredicate:Predicate<T>

the result predicate

resultHandler:CheckedFunction<T, T>

the result handler

Returns:CheckedSupplier<T>

a supplier composed of supplier and exceptionHandler

recoverback to summary
public static <T> CheckedSupplier<T> recover(CheckedSupplier<T> supplier, List<Class<? extends Throwable>> exceptionTypes, CheckedFunction<Throwable, T> exceptionHandler)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

Parameters
<T>
return type of after
supplier:CheckedSupplier<T>

the supplier which should be recovered from a certain exception

exceptionTypes:List<Class<? extends Throwable>>

the specific exception types that should be recovered

exceptionHandler:CheckedFunction<Throwable, T>

the exception handler

Returns:CheckedSupplier<T>

a supplier composed of supplier and exceptionHandler

recoverback to summary
public static <X extends Throwable, T> CheckedSupplier<T> recover(CheckedSupplier<T> supplier, Class<X> exceptionType, CheckedFunction<Throwable, T> exceptionHandler)

Returns a composed supplier that first executes the supplier and optionally recovers from an exception.

Parameters
<T>
return type of after
supplier:CheckedSupplier<T>

the supplier which should be recovered from a certain exception

exceptionType:Class<X>

the specific exception type that should be recovered

exceptionHandler:CheckedFunction<Throwable, T>

the exception handler

Returns:CheckedSupplier<T>

a supplier composed of callable and exceptionHandler