Interface WaiterAcceptor<T>

All Known Implementing Classes:
WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor, WaitersRuntime.ResponseStatusAcceptor

public interface WaiterAcceptor<T>
Inspects the response or errors returned from the operation and determines whether an expected state is met and returns the next WaiterState that the waiter should be transitioned to.
  • Method Details

    • waiterState

      WaiterState waiterState()
      Returns:
      the next WaiterState that the waiter should be transitioned to
    • matches

      default boolean matches(T response)
      Check to see if the response matches with the expected state defined by this acceptor
      Parameters:
      response - the response to inspect
      Returns:
      whether it accepts the response
    • matches

      default boolean matches(Throwable throwable)
      Check to see if the exception matches the expected state defined by this acceptor
      Parameters:
      throwable - the exception to inspect
      Returns:
      whether it accepts the throwable
    • message

      default Optional<String> message()
      Optional message to provide pertaining to the next WaiterState
      Returns:
      the optional message
    • successOnResponseAcceptor

      static <T> WaiterAcceptor<T> successOnResponseAcceptor(Predicate<T> responsePredicate)
      Creates a success waiter acceptor which determines if the exception should transition the waiter to success state
      Type Parameters:
      T - the response type
      Parameters:
      responsePredicate - the predicate of the response
      Returns:
      a WaiterAcceptor
    • successOnExceptionAcceptor

      static <T> WaiterAcceptor<T> successOnExceptionAcceptor(Predicate<Throwable> errorPredicate)
      Creates an error waiter acceptor which determines if the exception should transition the waiter to success state
      Type Parameters:
      T - the response type
      Parameters:
      errorPredicate - the Throwable predicate
      Returns:
      a WaiterAcceptor
    • errorOnExceptionAcceptor

      static <T> WaiterAcceptor<T> errorOnExceptionAcceptor(Predicate<Throwable> errorPredicate)
      Creates an error waiter acceptor which determines if the exception should transition the waiter to failure state
      Type Parameters:
      T - the response type
      Parameters:
      errorPredicate - the Throwable predicate
      Returns:
      a WaiterAcceptor
    • errorOnResponseAcceptor

      static <T> WaiterAcceptor<T> errorOnResponseAcceptor(Predicate<T> responsePredicate)
      Creates a success waiter acceptor which determines if the exception should transition the waiter to success state
      Type Parameters:
      T - the response type
      Parameters:
      responsePredicate - the predicate of the response
      Returns:
      a WaiterAcceptor
    • errorOnResponseAcceptor

      static <T> WaiterAcceptor<T> errorOnResponseAcceptor(Predicate<T> responsePredicate, String message)
      Creates a success waiter acceptor which determines if the exception should transition the waiter to success state
      Type Parameters:
      T - the response type
      Parameters:
      responsePredicate - the predicate of the response
      Returns:
      a WaiterAcceptor
    • retryOnExceptionAcceptor

      static <T> WaiterAcceptor<T> retryOnExceptionAcceptor(Predicate<Throwable> errorPredicate)
      Creates a retry on exception waiter acceptor which determines if the exception should transition the waiter to retry state
      Type Parameters:
      T - the response type
      Parameters:
      errorPredicate - the Throwable predicate
      Returns:
      a WaiterAcceptor
    • retryOnResponseAcceptor

      static <T> WaiterAcceptor<T> retryOnResponseAcceptor(Predicate<T> responsePredicate)
      Creates a retry on exception waiter acceptor which determines if the exception should transition the waiter to retry state
      Type Parameters:
      T - the response type
      Parameters:
      responsePredicate - the Throwable predicate
      Returns:
      a WaiterAcceptor