Top Description Fields Constructors Methods
org.springframework.messaging.handler.invocation

public Class ReactiveReturnValueHandler

extends AbstractAsyncReturnValueHandler
Class Inheritance
Imports
java.util.concurrent.CompletableFuture, reactor.core.publisher.Mono, org.springframework.core.MethodParameter, .ReactiveAdapter, .ReactiveAdapterRegistry

Support for single-value reactive types (like Mono or Single) as a return value type.
Author
Sebastien Deleuze
Since
5.1

Field Summary

Modifier and TypeField and Description
private final ReactiveAdapterRegistry

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public boolean
isAsyncReturnValue(Object
the value returned from the handler method
returnValue
,
MethodParameter
the type of the return value
returnType
)

Overrides org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler.isAsyncReturnValue.

Implements org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.isAsyncReturnValue.

Whether the return value represents an asynchronous, Future-like type with success and error callbacks.
public boolean
supportsReturnType(MethodParameter
the method return type to check
returnType
)

Implements org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.
public CompletableFuture<?>
toCompletableFuture(Object
the value returned from the handler method
returnValue
,
MethodParameter
the type of the return value
returnType
)

Implements org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.toCompletableFuture.

Adapt the asynchronous return value to a CompletableFuture.
Inherited from org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler:
handleReturnValue

Field Detail

adapterRegistryback to summary
private final ReactiveAdapterRegistry adapterRegistry

Constructor Detail

ReactiveReturnValueHandlerback to summary
public ReactiveReturnValueHandler()
ReactiveReturnValueHandlerback to summary
public ReactiveReturnValueHandler(ReactiveAdapterRegistry adapterRegistry)

Method Detail

isAsyncReturnValueback to summary
public boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType)

Overrides org.springframework.messaging.handler.invocation.AbstractAsyncReturnValueHandler.isAsyncReturnValue.

Implements org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.isAsyncReturnValue.

Doc from org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.isAsyncReturnValue.

Whether the return value represents an asynchronous, Future-like type with success and error callbacks. If this method returns true, then toCompletableFuture is invoked next. If it returns false, then handleReturnValue is called.

Note

this method will only be invoked after supportsReturnType(org.springframework.core.MethodParameter) is called and it returns true.

Parameters
returnValue:Object

the value returned from the handler method

returnType:MethodParameter

the type of the return value

Returns:boolean

true if the return value type represents an async value

Annotations
@Override
supportsReturnTypeback to summary
public boolean supportsReturnType(MethodParameter returnType)

Implements org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler.supportsReturnType.

Doc from org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.

Parameters
returnType:MethodParameter

the method return type to check

Returns:boolean

true if this handler supports the supplied return type; false otherwise

Annotations
@Override
toCompletableFutureback to summary
public CompletableFuture<?> toCompletableFuture(Object returnValue, MethodParameter returnType)

Implements org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.toCompletableFuture.

Doc from org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler.toCompletableFuture.

Adapt the asynchronous return value to a CompletableFuture.

Return value handling will then continue when the CompletableFuture is completed with either success or error.

Note

this method will only be invoked after supportsReturnType(org.springframework.core.MethodParameter) is called and it returns true.

Parameters
returnValue:Object

the value returned from the handler method

returnType:MethodParameter

the type of the return value

Returns:CompletableFuture<?>

the resulting CompletableFuture, or null in which case no further handling will be performed

Annotations
@Override