Top Constructors Methods
io.github.resilience4j.core

public Class SupplierUtils

extends Object
Class Inheritance
Imports
java.util.List, java.util.function.*

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
>
Supplier<R>

Returns:

a function composed of supplier and resultHandler
andThen
(Supplier<T>
the supplier
supplier
,
Function<T, R>
the function applied after supplier
resultHandler
)

Returns a composed Supplier that first applies the Supplier and then applies the resultHandler.

public static <
return type of after
T
, R>
Supplier<R>

Returns:

a function composed of supplier and handler
andThen
(Supplier<T>
the supplier
supplier
,
BiFunction<T, Throwable, R>
the function applied after supplier
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
, R>
Supplier<R>

Returns:

a function composed of supplier and handler
andThen
(Supplier<T>
the supplier which should be recovered from a certain exception
supplier
,
Function<T, R>
the function applied after Supplier was successful
resultHandler
,
Function<Throwable, R>
the function applied after Supplier has failed
exceptionHandler
)

Returns a composed function that first applies the Supplier and then applies either the resultHandler or exceptionHandler.

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

Returns:

a function composed of supplier and exceptionHandler
recover
(Supplier<T>
the supplier
supplier
,
Predicate<T>
the result predicate
resultPredicate
,
UnaryOperator<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
>
Supplier<T>

Returns:

a function composed of supplier and exceptionHandler
recover
(Supplier<T>
the supplier
supplier
,
Function<Throwable, T>
the exception handler
exceptionHandler
)

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

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

Returns:

a function composed of supplier and exceptionHandler
recover
(Supplier<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
,
Function<Throwable, T>
the exception handler
exceptionHandler
)

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

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

Returns:

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

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SupplierUtilsback to summary
private SupplierUtils()

Method Detail

andThenback to summary
public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler)

Returns a composed Supplier that first applies the Supplier and then applies the resultHandler.

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

the supplier

resultHandler:Function<T, R>

the function applied after supplier

Returns:Supplier<R>

a function composed of supplier and resultHandler

andThenback to summary
public static <T, R> Supplier<R> andThen(Supplier<T> supplier, BiFunction<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 after
supplier:Supplier<T>

the supplier

handler:BiFunction<T, Throwable, R>

the function applied after supplier

Returns:Supplier<R>

a function composed of supplier and handler

andThenback to summary
public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler, Function<Throwable, R> exceptionHandler)

Returns a composed function that first applies the Supplier and then applies either the resultHandler or exceptionHandler.

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

the supplier which should be recovered from a certain exception

resultHandler:Function<T, R>

the function applied after Supplier was successful

exceptionHandler:Function<Throwable, R>

the function applied after Supplier has failed

Returns:Supplier<R>

a function composed of supplier and handler

recoverback to summary
public static <T> Supplier<T> recover(Supplier<T> supplier, Predicate<T> resultPredicate, UnaryOperator<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:Supplier<T>

the supplier

resultPredicate:Predicate<T>

the result predicate

resultHandler:UnaryOperator<T>

the result handler

Returns:Supplier<T>

a function composed of supplier and exceptionHandler

recoverback to summary
public static <T> Supplier<T> recover(Supplier<T> supplier, Function<Throwable, T> exceptionHandler)

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

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

the supplier

exceptionHandler:Function<Throwable, T>

the exception handler

Returns:Supplier<T>

a function composed of supplier and exceptionHandler

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

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

Parameters
<T>
return type of after
supplier:Supplier<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:Function<Throwable, T>

the exception handler

Returns:Supplier<T>

a function composed of supplier and exceptionHandler

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

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

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

the supplier which should be recovered from a certain exception

exceptionType:Class<X>

the specific exception type that should be recovered

exceptionHandler:Function<Throwable, T>

the exception handler

Returns:Supplier<T>

a function composed of supplier and exceptionHandler