本文整理了Java中com.wordnik.swagger.annotations.Api
类的一些代码示例,展示了Api
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Api
类的具体详情如下:
包路径:com.wordnik.swagger.annotations.Api
类名称:Api
暂无
代码示例来源:origin: aol/micro-server
@Path("/stats")
@Component
@Api(value = "/stats", description = "Resource to show stats for a box using sigar")
public class StatsResource implements RestResource {
@GET
@Path("/ping")
@Produces("application/json")
@ApiOperation(value = "Make a ping call", response = List.class)
public List<Integer> getMachineStats() {
return ImmutableList.of(1);
}
}
代码示例来源: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: rhq-project/rhq
Api api = classElementIn.getAnnotation(Api.class);
if (api!=null) {
String shortDescription = api.value();
setOptionalAttribute(classElement, "shortDesc", shortDescription);
String longDescription = api.description();
setOptionalAttribute(classElement, "description", longDescription);
String basePathAttr = api.basePath();
setOptionalAttribute(classElement, "basePath",basePathAttr);
代码示例来源:origin: com.mangofactory/swagger-springmvc
@Override
public Optional<String> apply(Api input) {
if (null != input) {
String stripSlashes = input.value().replace("/", "");
return Optional.fromNullable(emptyToNull(stripSlashes));
}
return Optional.absent();
}
};
代码示例来源:origin: com.mangofactory/swagger-springmvc
@Override
public Integer getResourcePosition(RequestMappingInfo requestMappingInfo, HandlerMethod handlerMethod) {
Class<?> controllerClass = handlerMethod.getBeanType();
Api apiAnnotation = AnnotationUtils.findAnnotation(controllerClass, Api.class);
if (null != apiAnnotation && hasText(apiAnnotation.value())) {
return apiAnnotation.position();
}
return 0;
}
代码示例来源: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: wkennedy/swagger4spring-web
Api controllerApi = controllerClass.getAnnotation(Api.class);
if (controllerApi != null) {
resourcePath = controllerApi.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: com.github.springdox/springdox-swagger-common
@Override
public Optional<String> apply(Api input) {
if (null != input) {
String stripSlashes = input.value().replace("/", "");
return Optional.fromNullable(emptyToNull(stripSlashes));
}
return Optional.absent();
}
};
代码示例来源:origin: com.github.springdox/springdox-swagger-common
@Override
public Integer getResourcePosition(RequestMappingInfo requestMappingInfo, HandlerMethod handlerMethod) {
Class<?> controllerClass = handlerMethod.getBeanType();
Api apiAnnotation = AnnotationUtils.findAnnotation(controllerClass, Api.class);
if (null != apiAnnotation && hasText(apiAnnotation.value())) {
return apiAnnotation.position();
}
return 0;
}
代码示例来源: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.googlecode.redbox-mint/redbox-web-service
@Api(value = "messaging", description = "Operations to interact with the asynchronous message queue")
public class QueueMessageResource extends RedboxServerResource {
@ApiOperation(value = "Queues a message on the specified message queue", tags = "messaging")
@ApiResponses({ @ApiResponse(code = 200, message = "The record's metadata is updated"),
@ApiResponse(code = 500, message = "General Error", response = Exception.class) })
@Post("json")
public String sendMessageToQueue(JsonRepresentation data) throws IOException, MessagingException {
MessagingServices ms = MessagingServices.getInstance();
String messageQueue = getAttribute("messageQueue");
String message = data.getText();
ms.queueMessage(messageQueue, message);
return getSuccessResponseString(null);
}
}
代码示例来源: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: jboss-fuse/fabric8
com.wordnik.swagger.annotations.Api api = resourceClass.getAnnotation(com.wordnik.swagger.annotations.Api.class);
if (api != null) {
String apiPath = api.value();
String serverAddress = server.getEndpoint().getEndpointInfo().getAddress();
String apiDocs = serverAddress + "/api-docs";
代码示例来源: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;
}
代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service
@Api(value = "object", description = "Operations on ReDBox Objects")
public class DeleteObjectResource extends RedboxServerResource {
@ApiOperation(value = "Delete an existing ReDBox object", tags = "object")
@ApiResponses({ @ApiResponse(code = 200, message = "The object is deleted"),
@ApiResponse(code = 500, message = "General Error", response = Exception.class) })
@Delete
public String deleteObjectResource() throws IOException, PluginException, MessagingException {
Storage storage = (Storage) ApplicationContextProvider.getApplicationContext().getBean("fascinatorStorage");
Indexer indexer = (Indexer) ApplicationContextProvider.getApplicationContext().getBean("fascinatorIndexer");
String oid = getAttribute("oid");
storage.removeObject(oid);
indexer.remove(oid);
return getSuccessResponseString(oid);
}
}
代码示例来源: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: com.sitewhere/sitewhere-rest
throw new SiteWhereException("Swagger Api annotation missing on documented controller.");
parsed.setResource(api.value());
代码示例来源:origin: org.rhq/rhq-enterprise-server
/**
* @author Lukas Krejci
* @since 4.10
*/
@Api("Encapsulates a simple boolean value. In XML this is represented as <value value=\"...\"/>")
public final class BooleanValue {
private boolean value;
public BooleanValue() {
}
public BooleanValue(boolean value) {
this.value = value;
}
public boolean isValue() {
return value;
}
public void setValue(boolean value) {
this.value = value;
}
}
代码示例来源: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());
}
}
内容来源于网络,如有侵权,请联系作者删除!