Class Fallback.Builder<T>

java.lang.Object
io.helidon.nima.faulttolerance.Fallback.Builder<T>
Type Parameters:
T - type of the values returned
All Implemented Interfaces:
Builder<Fallback.Builder<T>,Fallback<T>>, Supplier<Fallback<T>>
Enclosing interface:
Fallback<T>

public static class Fallback.Builder<T> extends Object implements Builder<Fallback.Builder<T>,Fallback<T>>
Fluent API builder for Fallback.
  • Method Details

    • build

      public Fallback<T> build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<Fallback.Builder<T>,Fallback<T>>
      Returns:
      instance of the built type
    • fallback

      public Fallback.Builder<T> fallback(Function<Throwable,? extends T> fallback)
      Configure a fallback for a type.
      Parameters:
      fallback - fallback supplier to obtain the alternative result
      Returns:
      updated builder instance
    • applyOn

      @SafeVarargs public final Fallback.Builder<T> applyOn(Class<? extends Throwable>... classes)
      Apply fallback on these throwable classes. Cannot be combined with skipOn(Class[]).
      Parameters:
      classes - classes to fallback on
      Returns:
      updated builder instance
    • addApplyOn

      public Fallback.Builder<T> addApplyOn(Class<? extends Throwable> clazz)
      Apply fallback on this throwable class.
      Parameters:
      clazz - class to fallback on
      Returns:
      updated builder instance
    • skipOn

      @SafeVarargs public final Fallback.Builder<T> skipOn(Class<? extends Throwable>... classes)
      Do not apply fallback on these throwable classes. Cannot be combined with applyOn(Class[]).
      Parameters:
      classes - classes not to fallback on
      Returns:
      updated builder instance
    • addSkipOn

      public Fallback.Builder<T> addSkipOn(Class<? extends Throwable> clazz)
      Do not apply fallback on this throwable class.
      Parameters:
      clazz - class not to fallback on
      Returns:
      updated builder instance