Example usage for org.springframework.web.method HandlerMethod getReturnType

List of usage examples for org.springframework.web.method HandlerMethod getReturnType

Introduction

In this page you can find the example usage for org.springframework.web.method HandlerMethod getReturnType.

Prototype

public MethodParameter getReturnType() 

Source Link

Document

Return the HandlerMethod return type.

Usage

From source file:capital.scalable.restdocs.payload.JacksonResponseFieldSnippet.java

private boolean isPageResponse(HandlerMethod handlerMethod) {
    return handlerMethod.getReturnType().getParameterType() == Page.class;
}

From source file:capital.scalable.restdocs.payload.JacksonResponseFieldSnippet.java

@Override
protected Type getType(final HandlerMethod method) {
    Class<?> returnType = method.getReturnType().getParameterType();
    if (returnType == ResponseEntity.class) {
        return firstGenericType(method.getReturnType());
    } else if (returnType == Page.class) {
        return firstGenericType(method.getReturnType());
    } else if (isCollection(returnType)) {
        return new GenericArrayType() {

            @Override/*ww w .  ja  va2  s.  c  o  m*/
            public Type getGenericComponentType() {
                return firstGenericType(method.getReturnType());
            }
        };
    } else if ("void".equals(returnType.getName())) {
        return null;
    } else {
        return returnType;
    }
}