• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PathUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.swagger.util.PathUtils的典型用法代码示例。如果您正苦于以下问题:Java PathUtils类的具体用法?Java PathUtils怎么用?Java PathUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PathUtils类属于io.swagger.util包,在下文中一共展示了PathUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getOperationPaths

import io.swagger.util.PathUtils; //导入依赖的package包/类
public static Set<String> getOperationPaths(final Class<?> cls) {
    final Set<String> operationPaths = new HashSet<String>();
    final javax.ws.rs.Path apiPath = cls.getAnnotation(javax.ws.rs.Path.class);
    final Method methods[] = cls.getMethods();
    for (Method method : methods) {
        if (ReflectionUtils.isOverriddenMethod(method, cls)) {
            continue;
        }
        final javax.ws.rs.Path methodPath = getAnnotation(method, javax.ws.rs.Path.class);
        String operationPath = getPath(apiPath, methodPath);
        final Map<String, String> regexMap = new HashMap<String, String>();
        operationPath = PathUtils.parsePath(operationPath, regexMap);
        if (operationPath != null) {
            operationPaths.add(operationPath);
        }
    }
    return Collections.unmodifiableSet(operationPaths);
}
 
开发者ID:WASdev,项目名称:tool.swagger.docgen,代码行数:19,代码来源:JAXRSAnnotationsUtil.java


示例2: getPath

import io.swagger.util.PathUtils; //导入依赖的package包/类
@Override
public String getPath(ReaderContext context, Method method) {
    String p = null;
    Api apiAnnotation = context.getCls().getAnnotation(Api.class);
    ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
    String operationPath = apiOperation == null ? null : apiOperation.nickname();
    if (operationPath != null && !operationPath.isEmpty()) {
        // same logic as ServletReaderExtension
        p = PathUtils.collectPath(context.getParentPath(),
                apiAnnotation == null ? null : apiAnnotation.value(), operationPath);
    }
    else {
        // try JAX-RS annotations
        Path parentPath = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Path.class);
        if (parentPath != null && parentPath.value() != null && !parentPath.value().isEmpty()) {
            p = parentPath.value();
        }
        Path path = ReflectionUtils.getAnnotation(method, Path.class);
        if (path != null && path.value() != null && !path.value().isEmpty()) {
            if (p == null)
                p = path.value();
            else {
                if (path.value().startsWith("/"))
                    p += path.value();
                else
                    p = p + "/" + path.value();
            }
        }
    }
    return p;
}
 
开发者ID:limberest,项目名称:limberest,代码行数:32,代码来源:SwaggerReaderExtension.java


示例3: getPath

import io.swagger.util.PathUtils; //导入依赖的package包/类
@Override
public String getPath(ReaderContext context, Method method) {
	final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
	String operationId = null == apiOperation ? ""
			: StringUtils.isBlank(apiOperation.nickname()) ? null : apiOperation.nickname();
	return PathUtils.collectPath(context.getParentPath(), context.getInterfaceCls().getName(),
			method.getName(), operationId);

}
 
开发者ID:Sayi,项目名称:swagger-dubbo,代码行数:10,代码来源:DubboReaderExtension.java


示例4: getPath

import io.swagger.util.PathUtils; //导入依赖的package包/类
public String getPath(ReaderContext context, Method method) {
    final Api apiAnnotation = context.getCls().getAnnotation(Api.class);
    final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
    final String operationPath = apiOperation == null ? null : apiOperation.nickname();
    return PathUtils.collectPath(context.getParentPath(),
            apiAnnotation == null ? null : apiAnnotation.value(),
            StringUtils.isBlank(operationPath) ? method.getName() : operationPath);
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:9,代码来源:ControllerReaderExtension.java


示例5: read

import io.swagger.util.PathUtils; //导入依赖的package包/类
private void read(ReaderContext context) {

        for (Method method : context.getCls().getDeclaredMethods()) {
            if (ReflectionUtils.isOverriddenMethod(method, context.getCls())) {
                continue;
            }
            final Operation operation = new Operation();


            final Type[] genericParameterTypes = method.getGenericParameterTypes();
            final Annotation[][] paramAnnotations = method.getParameterAnnotations();

            ControllerReaderExtension extension = new ControllerReaderExtension();

            String methodPath = "index".equals(method.getName()) ? "" : "/" + method.getName();
            String operationPath = JbootControllerManager.me().getPathByController((Class<? extends Controller>) context.getCls()) + methodPath;

            String httpMethod = extension.getHttpMethod(context, method);

            if (operationPath == null || httpMethod == null) {
                continue;
            }

            if (extension.isReadable(context)) {
                extension.setDeprecated(operation, method);
                extension.applyConsumes(context, operation, method);
                extension.applyProduces(context, operation, method);
                extension.applyOperationId(operation, method);
                extension.applySummary(operation, method);
                extension.applyDescription(operation, method);
                extension.applySchemes(context, operation, method);
                extension.applySecurityRequirements(context, operation, method);
                extension.applyTags(context, operation, method);
                extension.applyResponses(swagger, context, operation, method);
                extension.applyImplicitParameters(swagger, context, operation, method);
                extension.applyExtensions(context, operation, method);
                for (int i = 0; i < genericParameterTypes.length; i++) {
                    extension.applyParameters(httpMethod, context, operation, paramAnnotations[i]);
                }

                if ("post".equalsIgnoreCase(httpMethod) && operation.getConsumes() == null) {
                    operation.addConsumes("application/x-www-form-urlencoded");
                }
            }

            if (operation.getResponses() == null) {
                operation.defaultResponse(new Response().description("successful operation"));
            }

            final Map<String, String> regexMap = new HashMap<String, String>();
            final String parsedPath = PathUtils.parsePath(operationPath, regexMap);

            Path path = swagger.getPath(parsedPath);
            if (path == null) {
                path = new SwaggerPath();
                swagger.path(parsedPath, path);
            }
            path.set(httpMethod.toLowerCase(), operation);
        }
    }
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:61,代码来源:Reader.java


示例6: getPath

import io.swagger.util.PathUtils; //导入依赖的package包/类
@Override
public String getPath(ReaderContext context, Method method) {
    String p = null;
    Api apiAnnotation = context.getCls().getAnnotation(Api.class);
    ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
    String operationPath = apiOperation == null ? null : apiOperation.nickname();
    if (operationPath != null && !operationPath.isEmpty()) {
        // same logic as ServletReaderExtension
        p = PathUtils.collectPath(context.getParentPath(),
                apiAnnotation == null ? null : apiAnnotation.value(), operationPath);
    }
    else {
        // try JAX-RS annotations
        Path parentPath = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Path.class);
        if (parentPath != null && parentPath.value() != null && !parentPath.value().isEmpty()) {
            p = parentPath.value();
        }
        Path path = ReflectionUtils.getAnnotation(method, Path.class);
        if (path != null && path.value() != null && !path.value().isEmpty()) {
            if (p == null)
                p = path.value();
            else {
                if (path.value().startsWith("/"))
                    p += path.value();
                else
                    p = p + "/" + path.value();
            }
        }
        // check dynamic java, which has package-based pathing
        java.lang.Package pkg = method.getDeclaringClass().getPackage();
        if (p != null && "MDW".equals(pkg.getImplementationTitle())) {
            if (p.startsWith("/"))
                p = "/" + pkg.getName().replace('.', '/') + p;
            else
                p = "/" + pkg.getName().replace('.', '/') + "/" + p;
        }

        if (apiOperation != null) {
            ApiImplicitParams implicitParams = ReflectionUtils.getAnnotation(method, ApiImplicitParams.class);
            if (implicitParams != null && implicitParams.value() != null && implicitParams.value().length == 1) {
                ApiImplicitParam implicitParam = implicitParams.value()[0];
                if (implicitParam.name() != null && !"body".equals(implicitParam.paramType()) && !"query".equals(implicitParam.paramType()))
                    p += "/{" + implicitParam.name() + "}";
            }
        }
    }

    return p;
}
 
开发者ID:CenturyLinkCloud,项目名称:mdw,代码行数:50,代码来源:ResourceReaderExtension.java


示例7: parseOperationPath

import io.swagger.util.PathUtils; //导入依赖的package包/类
protected String parseOperationPath(String operationPath, Map<String, String> regexMap) {
    return PathUtils.parsePath(operationPath, regexMap);
}
 
开发者ID:kongchen,项目名称:swagger-maven-plugin,代码行数:4,代码来源:AbstractReader.java



注:本文中的io.swagger.util.PathUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Command类代码示例发布时间:2022-05-23
下一篇:
Java ConnectProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap