Class AbstractAsyncReturnValueHandler
java.lang.Object
org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
- All Implemented Interfaces:
AsyncHandlerMethodReturnValueHandler, HandlerMethodReturnValueHandler
- Direct Known Subclasses:
CompletableFutureReturnValueHandler, ReactiveReturnValueHandler
public abstract class AbstractAsyncReturnValueHandler
extends Object
implements AsyncHandlerMethodReturnValueHandler
Convenient base class for
AsyncHandlerMethodReturnValueHandler
implementations that support only asynchronous (Future-like) return values.- Since:
- 4.2
- Author:
- Sebastien Deleuze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleReturnValue(@Nullable Object returnValue, org.springframework.core.MethodParameter returnType, Message<?> message) Handle the given return value.booleanisAsyncReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType) Whether the return value represents an asynchronous, Future-like type with success and error callbacks.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AsyncHandlerMethodReturnValueHandler
toCompletableFutureMethods inherited from interface HandlerMethodReturnValueHandler
supportsReturnType
-
Constructor Details
-
AbstractAsyncReturnValueHandler
public AbstractAsyncReturnValueHandler()
-
-
Method Details
-
isAsyncReturnValue
public boolean isAsyncReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType) Description copied from interface:AsyncHandlerMethodReturnValueHandlerWhether the return value represents an asynchronous, Future-like type with success and error callbacks. If this method returnstrue, thenAsyncHandlerMethodReturnValueHandler.toCompletableFuture(Object, MethodParameter)is invoked next. If it returnsfalse, thenHandlerMethodReturnValueHandler.handleReturnValue(Object, MethodParameter, 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, org.springframework.core.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
-