public class ReactiveReturnValueHandler extends AbstractAsyncReturnValueHandler
Mono or Single)
as a return value type.| Constructor and Description |
|---|
ReactiveReturnValueHandler() |
ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAsyncReturnValue(Object returnValue,
MethodParameter returnType)
Whether the return value represents an asynchronous, Future-like type
with success and error callbacks.
|
boolean |
supportsReturnType(MethodParameter returnType)
Whether the given method return type is
supported by this handler.
|
ListenableFuture<?> |
toListenableFuture(Object returnValue,
MethodParameter returnType)
Adapt the asynchronous return value to a
ListenableFuture. |
handleReturnValuepublic ReactiveReturnValueHandler()
public ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry)
public boolean supportsReturnType(MethodParameter returnType)
HandlerMethodReturnValueHandlerreturnType - the method return type to checktrue if this handler supports the supplied return type;
false otherwisepublic boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType)
AsyncHandlerMethodReturnValueHandlertrue,
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 AsyncHandlerMethodReturnValueHandlerisAsyncReturnValue in class AbstractAsyncReturnValueHandlerreturnValue - the value returned from the handler methodreturnType - the type of the return valuetrue if the return value type represents an async valuepublic ListenableFuture<?> toListenableFuture(Object returnValue, MethodParameter returnType)
AsyncHandlerMethodReturnValueHandlerListenableFuture.
Implementations should consider returning an instance of
SettableListenableFuture. Return value handling will then continue when
the ListenableFuture is completed with either success or error.
Note: this method will only be invoked after
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
is called and it returns true.
returnValue - the value returned from the handler methodreturnType - the type of the return valuenull in which case
no further handling will be performed