Property responseProperty; if (header.responseContainer().equalsIgnoreCase("list")) { responseProperty = new ArrayProperty(property); } else if (header.responseContainer().equalsIgnoreCase("map")) { responseProperty = new MapProperty(property); } else {
public static ResponseHeaderConfig convert(ResponseHeader responseHeader) { if (StringUtils.isEmpty(responseHeader.name())) { return null; } ResponseHeaderConfig config = new ResponseHeaderConfig(); config.setName(responseHeader.name()); config.setDescription(responseHeader.description()); config.setResponseClass(responseHeader.response()); config.setResponseContainer(responseHeader.responseContainer()); return config; }
private static ModelReference headerModel(ResponseHeader each) { ModelReference modelReference; String typeName = fromNullable(typeNameFor(each.response())).or("string"); if (isNullOrEmpty(each.responseContainer())) { modelReference = new ModelRef(typeName); } else { modelReference = new ModelRef(each.responseContainer(), new ModelRef(typeName)); } return modelReference; } }
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; }
public static ResponseHeaderConfig convert(ResponseHeader responseHeader) { if (StringUtils.isEmpty(responseHeader.name())) { return null; } ResponseHeaderConfig config = new ResponseHeaderConfig(); config.setName(responseHeader.name()); config.setDescription(responseHeader.description()); config.setResponseClass(responseHeader.response()); config.setResponseContainer(responseHeader.responseContainer()); return config; }
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers, JsonView jsonView) { Map<String, Property> responseHeaders = null; if (headers != null) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new LinkedHashMap<String, Property>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls, jsonView); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null && headers.length > 0) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper .wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new LinkedHashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null && headers.length > 0) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper .wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers, JsonView jsonView) { Map<String, Property> responseHeaders = null; if (headers != null) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new LinkedHashMap<String, Property>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls, jsonView); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
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; }