Java Code Examples for io.swagger.util.ReflectionUtils#isVoid()
The following examples show how to use
io.swagger.util.ReflectionUtils#isVoid() .
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 | 6 votes |
private static Map<String, Property> parseResponseHeaders(ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer( header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(context.getSwagger(), cls); } } } } return responseHeaders; }
Example 2
Source File: DubboReaderExtension.java From swagger-dubbo with Apache License 2.0 | 6 votes |
private static Map<String, Property> parseResponseHeaders(ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer( header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(context.getSwagger(), cls); } } } } return responseHeaders; }
Example 3
Source File: ControllerReaderExtension.java From jboot with Apache License 2.0 | 6 votes |
private static Map<String, Property> parseResponseHeaders(Swagger swagger, ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(swagger, cls); } } } } return responseHeaders; }
Example 4
Source File: ApiImplicitParamProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Override public Type getGenericType(ApiImplicitParam apiImplicitParam) { Type dataTypeClass = apiImplicitParam.dataTypeClass(); if (ReflectionUtils.isVoid(dataTypeClass)) { if (StringUtils.isEmpty(apiImplicitParam.dataType())) { return null; } dataTypeClass = ReflectionUtils.typeFromString(apiImplicitParam.dataType()); } if ("array".equals(apiImplicitParam.type())) { return Types.arrayOf(dataTypeClass); } return dataTypeClass; }
Example 5
Source File: RpcReaderExtension.java From sofa-rpc with Apache License 2.0 | 5 votes |
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 6
Source File: DubboReaderExtension.java From swagger-dubbo with Apache License 2.0 | 5 votes |
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 7
Source File: ControllerReaderExtension.java From jboot with Apache License 2.0 | 5 votes |
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 8
Source File: AbstractOperationGenerator.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
protected Model createResponseModel() { Type responseType = ParamUtils .getGenericParameterType(clazz, method.getDeclaringClass(), method.getGenericReturnType()); if (ReflectionUtils.isVoid(responseType)) { return null; } ResponseTypeProcessor processor = findResponseTypeProcessor(responseType); return processor.process(swaggerGenerator, this, responseType); }
Example 9
Source File: DefaultResponseTypeProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Override public Model process(SwaggerGenerator swaggerGenerator, OperationGenerator operationGenerator, Type genericResponseType) { Type responseType = extractResponseType(swaggerGenerator, operationGenerator, genericResponseType); if (responseType == null || ReflectionUtils.isVoid(responseType)) { return null; } if (responseType instanceof Class && Part.class.isAssignableFrom((Class<?>) responseType)) { responseType = Part.class; } SwaggerUtils.addDefinitions(swaggerGenerator.getSwagger(), responseType); Property property = ModelConverters.getInstance().readAsProperty(responseType); return new PropertyModelConverter().propertyToModel(property); }
Example 10
Source File: RpcReaderExtension.java From sofa-rpc with Apache License 2.0 | 4 votes |
private static boolean isValidResponse(Type type) { final JavaType javaType = TypeFactory.defaultInstance().constructType(type); return !ReflectionUtils.isVoid(javaType); }
Example 11
Source File: DubboReaderExtension.java From swagger-dubbo with Apache License 2.0 | 4 votes |
private static boolean isValidResponse(Type type) { final JavaType javaType = TypeFactory.defaultInstance().constructType(type); return !ReflectionUtils.isVoid(javaType); }
Example 12
Source File: ControllerReaderExtension.java From jboot with Apache License 2.0 | 4 votes |
private static boolean isValidResponse(Type type) { final JavaType javaType = TypeFactory.defaultInstance().constructType(type); return !ReflectionUtils.isVoid(javaType); }