org.springframework.messaging.handler.invocation

## 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
Constructor and Description
`AbstractAsyncReturnValueHandler()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `handleReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType, Message<?> message)` Handle the given return value.
`boolean` `isAsyncReturnValue(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 java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.messaging.handler.invocation.AsyncHandlerMethodReturnValueHandler

`toListenableFuture`

### Methods inherited from interface org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler

`supportsReturnType`

### Constructor Detail

#### AbstractAsyncReturnValueHandler

    public AbstractAsyncReturnValueHandler()

### Method Detail

#### isAsyncReturnValue

    public boolean isAsyncReturnValue(Object returnValue,
                                      org.springframework.core.MethodParameter returnType)

Description copied from interface: `AsyncHandlerMethodReturnValueHandler`
Whether the return value represents an asynchronous, Future-like type with success and error callbacks. If this method returns `true`, 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`.

Specified by:
  `isAsyncReturnValue` in interface `AsyncHandlerMethodReturnValueHandler`
Parameters:
  `returnValue` - the value returned from the handler method
  `returnType` - the type of the return value
Returns:
  `true` if 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: `HandlerMethodReturnValueHandler`
Handle the given return value.

Specified by:
  `handleReturnValue` in interface `HandlerMethodReturnValueHandler`
Parameters:
  `returnValue` - the value returned from the handler method
  `returnType` - the type of the return value. This type must have previously been passed to `HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)` and it must have returned `true`.
  `message` - the message that caused this method to be called