Class AbstractAsyncReturnValueHandler
java.lang.Object
org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
- All Implemented Interfaces:
AsyncHandlerMethodReturnValueHandler,HandlerMethodReturnValueHandler
- Direct Known Subclasses:
CompletableFutureReturnValueHandler,ListenableFutureReturnValueHandler,ReactiveReturnValueHandler
public abstract class AbstractAsyncReturnValueHandler
extends Object
implements AsyncHandlerMethodReturnValueHandler
Convenient base class for
AsyncHandlerMethodReturnValueHandler
implementations that support only asynchronous (Future-like) return values
and merely serve as adapters of such types to Spring's
ListenableFuture.- Since:
- 4.2
- Author:
- Sebastien Deleuze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleReturnValue(Object returnValue, MethodParameter returnType, Message<?> message) Handle the given return value.booleanisAsyncReturnValue(Object returnValue, MethodParameter returnType) Whether the return value represents an asynchronous, Future-like type with success and error callbacks.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler
toListenableFutureMethods inherited from interface org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler
supportsReturnType
-
Constructor Details
-
AbstractAsyncReturnValueHandler
public AbstractAsyncReturnValueHandler()
-
-
Method Details
-
isAsyncReturnValue
Description copied from interface:AsyncHandlerMethodReturnValueHandlerWhether the return value represents an asynchronous, Future-like type with success and error callbacks. If this method returnstrue, thenAsyncHandlerMethodReturnValueHandler.toListenableFuture(java.lang.Object, org.springframework.core.MethodParameter)is invoked next. If it returnsfalse, thenHandlerMethodReturnValueHandler.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 returnstrue.- Specified by:
isAsyncReturnValuein interfaceAsyncHandlerMethodReturnValueHandler- Parameters:
returnValue- the value returned from the handler methodreturnType- the type of the return value- Returns:
trueif the return value type represents an async value
-
handleReturnValue
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType, Message<?> message) Description copied from interface:HandlerMethodReturnValueHandlerHandle the given return value.- Specified by:
handleReturnValuein interfaceHandlerMethodReturnValueHandler- Parameters:
returnValue- the value returned from the handler methodreturnType- the type of the return value. This type must have previously been passed toHandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)and it must have returnedtrue.message- the message that caused this method to be called
-