當前位置: 首頁>>代碼示例>>Java>>正文


Java Property.setDescription方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Sayi,項目名稱:swagger-dubbo,代碼行數:26,代碼來源:DubboReaderExtension.java

示例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;
}
 
開發者ID:yangfuhai,項目名稱:jboot,代碼行數:24,代碼來源:ControllerReaderExtension.java

示例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;
}
 
開發者ID:mnemonic-no,項目名稱:common-services,代碼行數:26,代碼來源:ResultContainerTransformation.java

示例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"));
}
 
開發者ID:dotwebstack,項目名稱:dotwebstack-framework,代碼行數:13,代碼來源:ResponsePropertyTest.java


注:本文中的io.swagger.models.properties.Property.setDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。