public class HandlerMethodReturnValueHandlerComposite extends java.lang.Object implements AsyncHandlerMethodReturnValueHandler
HandlerMethodReturnValueHandler
s.
Previously resolved return types are cached for faster lookups.Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
private java.util.List<HandlerMethodReturnValueHandler> |
returnValueHandlers |
Constructor and Description |
---|
HandlerMethodReturnValueHandlerComposite() |
protected final Log logger
private final java.util.List<HandlerMethodReturnValueHandler> returnValueHandlers
public HandlerMethodReturnValueHandlerComposite()
public java.util.List<HandlerMethodReturnValueHandler> getHandlers()
public boolean supportsReturnType(MethodParameter returnType)
HandlerMethodReturnValueHandler
.supportsReturnType
in interface HandlerMethodReturnValueHandler
returnType
- the method return type to checktrue
if this handler supports the supplied return type;
false
otherwiseprivate HandlerMethodReturnValueHandler getReturnValueHandler(MethodParameter returnType)
public void handleReturnValue(java.lang.Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws java.lang.Exception
HandlerMethodReturnValueHandler
s and invoke the one that supports it.handleReturnValue
in interface HandlerMethodReturnValueHandler
returnValue
- the value returned from the handler methodreturnType
- the type of the return value. This type must have
previously been passed to HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
which must
have returned true
.mavContainer
- the ModelAndViewContainer for the current requestwebRequest
- the current requestjava.lang.IllegalStateException
- if no suitable HandlerMethodReturnValueHandler
is found.java.lang.Exception
- if the return value handling results in an errorprivate HandlerMethodReturnValueHandler selectHandler(java.lang.Object value, MethodParameter returnType)
public boolean isAsyncReturnValue(java.lang.Object value, MethodParameter returnType)
AsyncHandlerMethodReturnValueHandler
isAsyncReturnValue
in interface AsyncHandlerMethodReturnValueHandler
value
- the return valuereturnType
- the return typetrue
if the return value is asynchronous.public HandlerMethodReturnValueHandlerComposite addHandler(HandlerMethodReturnValueHandler handler)
HandlerMethodReturnValueHandler
.public HandlerMethodReturnValueHandlerComposite addHandlers(java.util.List<? extends HandlerMethodReturnValueHandler> handlers)
HandlerMethodReturnValueHandler
s.