com.wordnik.swagger.annotations.Api.description()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中com.wordnik.swagger.annotations.Api.description()方法的一些代码示例,展示了Api.description()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Api.description()方法的具体详情如下:
包路径:com.wordnik.swagger.annotations.Api
类名称:Api
方法名:description

Api.description介绍

暂无

代码示例

代码示例来源:origin: com.mangofactory/swagger-springmvc

@Override
 public Optional<String> apply(Api input) {
  if (null != input) {
   return Optional.fromNullable(emptyToNull(input.description()));
  }
  return Optional.absent();
 }
};

代码示例来源:origin: com.github.springdox/springdox-swagger-common

@Override
 public Optional<String> apply(Api input) {
  if (null != input) {
   return Optional.fromNullable(emptyToNull(input.description()));
  }
  return Optional.absent();
 }
};

代码示例来源:origin: com.mangofactory/swagger-springmvc

private String getDescription(HandlerMethod handlerMethod) {
  Class<?> controllerClass = handlerMethod.getBeanType();
  String description = splitCamelCase(controllerClass.getSimpleName(), " ");

  Api apiAnnotation = AnnotationUtils.findAnnotation(controllerClass, Api.class);
  if (null != apiAnnotation) {
   String descriptionFromAnnotation = Optional.fromNullable(emptyToNull(apiAnnotation.value()))
       .or(apiAnnotation.description());
   if (!isNullOrEmpty(descriptionFromAnnotation)) {
    return descriptionFromAnnotation;
   }
  }
  return description;
 }
}

代码示例来源:origin: org.graylog2/graylog2-shared

apiDescription.put("name", info.value());
apiDescription.put("path", path.value());
apiDescription.put("description", info.description());

代码示例来源:origin: rhq-project/rhq

String shortDescription = api.value();
setOptionalAttribute(classElement, "shortDesc", shortDescription);
String longDescription = api.description();
setOptionalAttribute(classElement, "description", longDescription);
String basePathAttr = api.basePath();

代码示例来源:origin: org.restlet.gae/org.restlet.ext.platform

/**
 * Adds data from the {@link Api} annotation to the resource.
 * 
 * @param api
 *            The {@link Api} annotation.
 * @param resource
 *            The {@link Resource} to update.
 */
public static void processApi(Api api, Resource resource) {
  if (!StringUtils.isNullOrEmpty(api.value())) {
    resource.setName(api.value());
  }
  if (!StringUtils.isNullOrEmpty(api.description())) {
    resource.setDescription(api.description());
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.platform

/**
 * Adds data from the {@link Api} annotation to the resource.
 * 
 * @param api
 *            The {@link Api} annotation.
 * @param resource
 *            The {@link Resource} to update.
 */
public static void processApi(Api api, Resource resource) {
  if (!StringUtils.isNullOrEmpty(api.value())) {
    resource.setName(api.value());
  }
  if (!StringUtils.isNullOrEmpty(api.description())) {
    resource.setDescription(api.description());
  }
}

代码示例来源:origin: org.restlet.jee/org.restlet.ext.apispark

/**
 * Adds data from the {@link Api} annotation to the resource.
 * 
 * @param api
 *            The {@link Api} annotation.
 * @param resource
 *            The {@link Resource} to update.
 */
public static void processApi(Api api, Resource resource) {
  if (!StringUtils.isNullOrEmpty(api.value())) {
    resource.setName(api.value());
  }
  if (!StringUtils.isNullOrEmpty(api.description())) {
    resource.setDescription(api.description());
  }
}

代码示例来源:origin: org.restlet.jse/org.restlet.ext.platform

/**
 * Adds data from the {@link Api} annotation to the resource.
 * 
 * @param api
 *            The {@link Api} annotation.
 * @param resource
 *            The {@link Resource} to update.
 */
public static void processApi(Api api, Resource resource) {
  if (!StringUtils.isNullOrEmpty(api.value())) {
    resource.setName(api.value());
  }
  if (!StringUtils.isNullOrEmpty(api.description())) {
    resource.setDescription(api.description());
  }
}

代码示例来源:origin: org.restlet.osgi/org.restlet.ext.platform

/**
 * Adds data from the {@link Api} annotation to the resource.
 * 
 * @param api
 *            The {@link Api} annotation.
 * @param resource
 *            The {@link Resource} to update.
 */
public static void processApi(Api api, Resource resource) {
  if (!StringUtils.isNullOrEmpty(api.value())) {
    resource.setName(api.value());
  }
  if (!StringUtils.isNullOrEmpty(api.description())) {
    resource.setDescription(api.description());
  }
}

代码示例来源:origin: wkennedy/swagger4spring-web

private Map<String, ApiListing> processControllers(Set<Class<?>> controllerClasses) {
  //Loop over end points (controllers)
  for (Class<?> controllerClass : controllerClasses) {
    if (ApiDocumentationController.class.isAssignableFrom(controllerClass)) {
      continue;
    }
    Set<Method> requestMappingMethods = AnnotationUtils.getAnnotatedMethods(controllerClass, RequestMapping.class);
    ApiListing apiListing = processControllerApi(controllerClass);
    String description = "";
    Api controllerApi = controllerClass.getAnnotation(Api.class);
    if (controllerApi != null) {
      description = controllerApi.description();
    }
    if (apiListing.apis().size() == 0) {
      apiListing = processMethods(requestMappingMethods, controllerClass, apiListing, description);
    }
    //Allow for multiple controllers having the same resource path.
    ApiListing existingApiListing = apiListingMap.get(apiListing.resourcePath());
    if (existingApiListing != null) {
      apiListing = ApiListingUtil.mergeApiListing(existingApiListing, apiListing);
    }
    // controllers without any operations are excluded from the apiListingMap list
    if (apiListing.apis() != null && !apiListing.apis().isEmpty()) {
      apiListingMap.put(apiListing.resourcePath(), apiListing);
    }
  }
  return apiListingMap;
}

相关文章