类 ReactiveReturnValueHandler
- java.lang.Object
- org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
- org.springframework.messaging.handler.invocation.ReactiveReturnValueHandler
public class ReactiveReturnValueHandler extends AbstractAsyncReturnValueHandler
Support for single-value reactive types (likeMono
orSingle
) as a return value type.- 从以下版本开始:
- 5.1
- 作者:
- Sebastien Deleuze
构造器概要
构造器 构造器 说明 ReactiveReturnValueHandler()
ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry)
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 aListenableFuture
.从类继承的方法 org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler
handleReturnValue
构造器详细资料
ReactiveReturnValueHandler
public ReactiveReturnValueHandler()
ReactiveReturnValueHandler
public ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry)
方法详细资料
supportsReturnType
public boolean supportsReturnType(MethodParameter returnType)
从接口复制的说明:HandlerMethodReturnValueHandler
Whether the given method return type is supported by this handler.- 参数:
returnType
- the method return type to check- 返回:
true
if this handler supports the supplied return type;false
otherwise
isAsyncReturnValue
public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType)
从接口复制的说明:AsyncHandlerMethodReturnValueHandler
Whether 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
.- 指定者:
isAsyncReturnValue
在接口中AsyncHandlerMethodReturnValueHandler
- 覆盖:
isAsyncReturnValue
在类中AbstractAsyncReturnValueHandler
- 参数:
returnValue
- the value returned from the handler methodreturnType
- the type of the return value- 返回:
true
if the return value type represents an async value
toListenableFuture
public ListenableFuture<?> toListenableFuture(Object returnValue, MethodParameter returnType)
从接口复制的说明:AsyncHandlerMethodReturnValueHandler
Adapt the asynchronous return value to aListenableFuture
. Implementations should consider returning an instance ofSettableListenableFuture
. 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 returnstrue
.- 参数:
returnValue
- the value returned from the handler methodreturnType
- the type of the return value- 返回:
- the resulting ListenableFuture, or
null
in which case no further handling will be performed