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()); } }
private static ResponseConfig convert(ApiOperation apiOperation) { ResponseConfig responseConfig = new ResponseConfig(); responseConfig.setCode(apiOperation.code()); responseConfig.setResponseClass(apiOperation.response()); responseConfig.setResponseContainer(apiOperation.responseContainer()); responseConfig.setResponseReference(apiOperation.responseReference()); responseConfig.setResponseHeaders(apiOperation.responseHeaders()); return responseConfig; }
@SuppressWarnings("Duplicates") @VisibleForTesting static ResolvedType getResolvedType( ApiOperation annotation, TypeResolver resolver, ResolvedType defaultType) { if (null != annotation) { Class<?> response = annotation.response(); String responseContainer = annotation.responseContainer(); if (resolvedType(resolver, response, responseContainer).isPresent()) { return resolvedType(resolver, response, responseContainer).get(); } } return defaultType; }
private static ResponseConfig convert(ApiOperation apiOperation) { ResponseConfig responseConfig = new ResponseConfig(); responseConfig.setCode(apiOperation.code()); responseConfig.setResponseClass(apiOperation.response()); responseConfig.setResponseContainer(apiOperation.responseContainer()); responseConfig.setResponseReference(apiOperation.responseReference()); responseConfig.setResponseHeaders(apiOperation.responseHeaders()); return responseConfig; }
@Override public Class<?> call() throws Exception { return apiOperation.response(); } }, this.env, Void.class);
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(); } }
private Class<?> getClassFromMethodAnnotationOrDefault(Method method, Class<?> def){ Class<?> type; try{ type = method.getAnnotation(ApiOperation.class).response(); } catch (Exception e) { type = def; LOG.debug("Unable to get class from annotation: {}. Defaulting to {}", e.getMessage(), def.getName()); Exceptions.propagateIfFatal(e); } return type; } });
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(); } }