Package io.smallrye.faulttolerance.api
Interface TypedGuard.Builder.FallbackBuilder<T>
- Enclosing interface:
TypedGuard.Builder<T>
public static interface TypedGuard.Builder.FallbackBuilder<T>
Configures a fallback.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionEquivalent toapplyOn(Set.of(value)).applyOn(Collection<Class<? extends Throwable>> value) Sets the set of exception types considered failure.done()Returns the original fault tolerance builder.Sets the fallback handler in the form of aFunctionthat transforms the exception to the fallback value.Sets the fallback handler in the form of a fallback valueSupplier.Equivalent toskipOn(Set.of(value)).skipOn(Collection<Class<? extends Throwable>> value) Sets the set of exception types considered success.Sets a predicate to determine when an exception should be considered failure and fallback should be applied.default TypedGuard.Builder.FallbackBuilder<T> with(Consumer<TypedGuard.Builder.FallbackBuilder<T>> consumer)
-
Method Details
-
handler
Sets the fallback handler in the form of a fallback valueSupplier.- Parameters:
value- the fallback value supplier, must not benull- Returns:
- this fallback builder
-
handler
Sets the fallback handler in the form of aFunctionthat transforms the exception to the fallback value.- Parameters:
value- the fallback value function, must not benull- Returns:
- this fallback builder
-
applyOn
Sets the set of exception types considered failure. Defaults to all exceptions (Throwable).- Parameters:
value- collection of exception types, must not benull- Returns:
- this fallback builder
- See Also:
-
applyOn
Equivalent toapplyOn(Set.of(value)).- Parameters:
value- an exception class, must not benull- Returns:
- this fallback builder
-
skipOn
Sets the set of exception types considered success. Defaults to no exception (empty set).- Parameters:
value- collection of exception types, must not benull- Returns:
- this fallback builder
- See Also:
-
skipOn
Equivalent toskipOn(Set.of(value)).- Parameters:
value- an exception class, must not benull- Returns:
- this fallback builder
-
when
Sets a predicate to determine when an exception should be considered failure and fallback should be applied. This is a more general variant ofapplyOn. Note that there is no generalizedskipOn, because all exceptions that do not match this predicate are implicitly considered success.If this method is called,
applyOnandskipOnmay not be called.- Parameters:
value- the predicate, must not benull- Returns:
- this fallback builder
-
done
TypedGuard.Builder<T> done()Returns the original fault tolerance builder.- Returns:
- the original fault tolerance builder
-
with
default TypedGuard.Builder.FallbackBuilder<T> with(Consumer<TypedGuard.Builder.FallbackBuilder<T>> consumer)
-