本文整理汇总了Java中io.swagger.models.properties.Property.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setDescription方法的具体用法?Java Property.setDescription怎么用?Java Property.setDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.properties.Property
的用法示例。
在下文中一共展示了Property.setDescription方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseResponseHeaders
import io.swagger.models.properties.Property; //导入方法依赖的package包/类
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;
}
示例2: parseResponseHeaders
import io.swagger.models.properties.Property; //导入方法依赖的package包/类
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;
}
示例3: injectResultContainerModel
import io.swagger.models.properties.Property; //导入方法依赖的package包/类
private ModelImpl injectResultContainerModel(Swagger swagger, ModelImpl innerModel, SwaggerRefPropertyFactory.PropertyContainerType containerType) {
// Only inject result container model once.
if (innerModel.getName().startsWith(resultContainerName)) {
return null;
}
// Create result container model instance based on result container definition.
Model model = swagger.getDefinitions().get(resultContainerName);
if (model == null || !(model instanceof ModelImpl)) {
return null;
}
ModelImpl resultContainerModel = (ModelImpl) model.clone();
// Set unique name of result container model per container type to avoid overwriting documentation.
resultContainerModel.setName(resultContainerName + "-" + innerModel.getName() + "-" + containerType);
// Inject innerModel into 'data' property.
Property dataProperty = SwaggerRefPropertyFactory.create(containerType, innerModel);
dataProperty.setRequired(true);
dataProperty.setDescription(createDataPropertyDescription(containerType));
resultContainerModel.addProperty(resultContainerDataProperty, dataProperty);
// Put result container model with injected innerModel into Swagger.
swagger.addDefinition(resultContainerModel.getName(), resultContainerModel);
return resultContainerModel;
}
示例4: getDescription_ReturnsResponseDescription_ForInputResponse
import io.swagger.models.properties.Property; //导入方法依赖的package包/类
@Test
public void getDescription_ReturnsResponseDescription_ForInputResponse() {
// Arrange
Property property = new ResponseProperty(new Response().description("foo"));
property.setDescription("bar");
// Act
String result = property.getDescription();
// Assert
assertThat(result, is("foo"));
}