Java Code Examples for io.swagger.annotations.ApiOperation#response()

The following examples show how to use io.swagger.annotations.ApiOperation#response() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RpcReaderExtension.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
private static Type getResponseType(Method method) {
    final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
    if (apiOperation != null && !ReflectionUtils.isVoid(apiOperation.response())) {
        return apiOperation.response();
    } else {
        return method.getGenericReturnType();
    }
}
 
Example 2
Source File: DubboReaderExtension.java    From swagger-dubbo with Apache License 2.0 5 votes vote down vote up
private static Type getResponseType(Method method) {
	final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
	if (apiOperation != null && !ReflectionUtils.isVoid(apiOperation.response())) {
		return apiOperation.response();
	} else {
		return method.getGenericReturnType();
	}
}
 
Example 3
Source File: JaxrsReader.java    From swagger-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void handleSubResource(String[] apiConsumes, String httpMethod, String[] apiProduces, Map<String, Tag> tags, Method method, ApiOperation apiOperation, String operationPath, Operation operation) {
    if (isSubResource(httpMethod, method)) {
        Class<?> responseClass = method.getReturnType();
        if (apiOperation != null && !apiOperation.response().equals(Void.class) && !apiOperation.response().equals(void.class)) {
            responseClass = apiOperation.response();
        }
        LOGGER.debug("handling sub-resource method " + method.toString() + " -> " + responseClass);
        read(responseClass, operationPath, httpMethod, true, apiConsumes, apiProduces, tags, operation.getParameters());
    }
}