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,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 Summary
Modifier and TypeMethodDescriptionstatic <T> WaiterAcceptor<T> errorOnExceptionAcceptor(Predicate<Throwable> errorPredicate) Creates an error waiter acceptor which determines if the exception should transition the waiter to failure statestatic <T> WaiterAcceptor<T> errorOnExceptionAcceptor(Predicate<Throwable> errorPredicate, String errorMessage) Creates an error waiter acceptor which determines if the exception should transition the waiter to failure state Overloaded method with errorMessage.static <T> WaiterAcceptor<T> errorOnResponseAcceptor(Predicate<T> responsePredicate) Creates a success waiter acceptor which determines if the exception should transition the waiter to success statestatic <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 statedefault booleanCheck to see if the exception matches the expected state defined by this acceptordefault booleanCheck to see if the response matches with the expected state defined by this acceptormessage()Optional message to provide pertaining to the next WaiterStatestatic <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 statestatic <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 statestatic <T> WaiterAcceptor<T> successOnExceptionAcceptor(Predicate<Throwable> errorPredicate) Creates an error waiter acceptor which determines if the exception should transition the waiter to success statestatic <T> WaiterAcceptor<T> successOnResponseAcceptor(Predicate<T> responsePredicate) Creates a success waiter acceptor which determines if the exception should transition the waiter to success state
-
Method Details
-
waiterState
WaiterState waiterState()- Returns:
- the next
WaiterStatethat the waiter should be transitioned to
-
matches
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
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
-
successOnResponseAcceptor
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
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- theThrowablepredicate- Returns:
- a
WaiterAcceptor
-
errorOnExceptionAcceptor
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- theThrowablepredicate- Returns:
- a
WaiterAcceptor
-
errorOnExceptionAcceptor
static <T> WaiterAcceptor<T> errorOnExceptionAcceptor(Predicate<Throwable> errorPredicate, String errorMessage) Creates an error waiter acceptor which determines if the exception should transition the waiter to failure state Overloaded method with errorMessage.- Parameters:
errorPredicate- theThrowablepredicateerrorMessage- Message with reason for failure.- Returns:
- a
WaiterAcceptor
-
errorOnResponseAcceptor
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
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- theThrowablepredicate- Returns:
- a
WaiterAcceptor
-
retryOnResponseAcceptor
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- theThrowablepredicate- Returns:
- a
WaiterAcceptor
-