unwrapFuture
protected <T extends DataSiftResult,A extends DataSiftResult> void unwrapFuture(FutureData<T> futureToUnwrap,
FutureData<A> futureReturnedToUser,
A expectedInstance,
FutureResponse<T> responseToExecuteOnSuccess)
To support futures being passed as parameters, this method adds a listener to the unprocessed future that has
been passed as a parameter. Once that listener is invoked, the response of the unprocessed future is examined
to see if the response was successful, if it was not then the expected future is passed the failed response
If the result of the unprocessed future is successful then the response callback is applied.
- Type Parameters:
T - A - - Parameters:
futureToUnwrap - the unprocessed future which needs to be unwrappedfutureReturnedToUser - the future that has been returned to the user and which callbacks need to be
triggered onexpectedInstance - the instance of the result type to use in failure scenariosresponseToExecuteOnSuccess - a future response object which contains the code which will execute once the
wrapped future has been unwrapped and its result is successful