public abstract class AbstractAsyncReturnValueHandler extends Object implements AsyncHandlerMethodReturnValueHandler
AsyncHandlerMethodReturnValueHandler
implementations that support only asynchronous (Future-like) return values
and merely serve as adapters of such types to Spring's
ListenableFuture
.Constructor and Description |
---|
AbstractAsyncReturnValueHandler() |
Modifier and Type | Method and Description |
---|---|
void |
handleReturnValue(Object returnValue,
MethodParameter returnType,
Message<?> message)
Handle the given return value.
|
boolean |
isAsyncReturnValue(Object returnValue,
MethodParameter returnType)
Whether the return value represents an asynchronous, Future-like type
with success and error callbacks.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toListenableFuture
supportsReturnType
public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType)
AsyncHandlerMethodReturnValueHandler
true
,
then AsyncHandlerMethodReturnValueHandler.toListenableFuture(java.lang.Object, org.springframework.core.MethodParameter)
is invoked next. If it returns
false
, then HandlerMethodReturnValueHandler.handleReturnValue(java.lang.Object, org.springframework.core.MethodParameter, org.springframework.messaging.Message<?>)
is called.
Note: this method will only be invoked after
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
is called and it returns true
.
isAsyncReturnValue
in interface AsyncHandlerMethodReturnValueHandler
returnValue
- the value returned from the handler methodreturnType
- the type of the return value.public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType, Message<?> message)
HandlerMethodReturnValueHandler
handleReturnValue
in interface HandlerMethodReturnValueHandler
returnValue
- the value returned from the handler methodreturnType
- the type of the return value. This type must have previously
been passed to HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
and it must have returned true
.message
- the message that caused this method to be called