本文整理匯總了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"));
}