Example usage for org.springframework.web.method.support HandlerMethodReturnValueHandler supportsReturnType

List of usage examples for org.springframework.web.method.support HandlerMethodReturnValueHandler supportsReturnType

Introduction

In this page you can find the example usage for org.springframework.web.method.support HandlerMethodReturnValueHandler supportsReturnType.

Prototype

boolean supportsReturnType(MethodParameter returnType);

Source Link

Document

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

Usage

From source file:org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.java

@Nullable
private HandlerMethodReturnValueHandler getReturnValueHandler(MethodParameter returnType) {
    for (HandlerMethodReturnValueHandler handler : this.returnValueHandlers) {
        if (handler.supportsReturnType(returnType)) {
            return handler;
        }//from  ww  w  .  jav  a2s  .  c om
    }
    return null;
}

From source file:org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.java

@Nullable
private HandlerMethodReturnValueHandler selectHandler(@Nullable Object value, MethodParameter returnType) {
    boolean isAsyncValue = isAsyncReturnValue(value, returnType);
    for (HandlerMethodReturnValueHandler handler : this.returnValueHandlers) {
        if (isAsyncValue && !(handler instanceof AsyncHandlerMethodReturnValueHandler)) {
            continue;
        }//from   ww w  .  ja v a  2 s . c  o  m
        if (handler.supportsReturnType(returnType)) {
            return handler;
        }
    }
    return null;
}