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

Java UriEndpoint类代码示例

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

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



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

示例1: process

import org.apache.camel.spi.UriEndpoint; //导入依赖的package包/类
public boolean process(Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
    try {
        if (roundEnv.processingOver()) {
            return true;
        }
        Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(UriEndpoint.class);
        for (Element element : elements) {
            if (element instanceof TypeElement) {
                processEndpointClass(roundEnv, (TypeElement) element);
            }
        }
    } catch (Throwable e) {
        dumpExceptionToErrorFile("camel-apt-error.log", "Error processing @UriEndpoint", e);
    }
    return true;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:EndpointAnnotationProcessor.java


示例2: writeJSonSchemeDocumentation

import org.apache.camel.spi.UriEndpoint; //导入依赖的package包/类
protected void writeJSonSchemeDocumentation(PrintWriter writer, RoundEnvironment roundEnv, TypeElement classElement, UriEndpoint uriEndpoint,
                                            String title, String scheme, String extendsScheme, String label) {
    // gather component information
    ComponentModel componentModel = findComponentProperties(roundEnv, uriEndpoint, classElement, title, scheme, extendsScheme, label);

    // get endpoint information which is divided into paths and options (though there should really only be one path)
    Set<EndpointPath> endpointPaths = new LinkedHashSet<EndpointPath>();
    Set<EndpointOption> endpointOptions = new LinkedHashSet<EndpointOption>();
    Set<ComponentOption> componentOptions = new LinkedHashSet<ComponentOption>();

    TypeElement componentClassElement = findTypeElement(roundEnv, componentModel.getJavaType());
    if (componentClassElement != null) {
        findComponentClassProperties(writer, roundEnv, componentModel, componentOptions, componentClassElement, "");
    }

    findClassProperties(writer, roundEnv, componentModel, endpointPaths, endpointOptions, classElement, "", uriEndpoint.excludeProperties());

    String json = createParameterJsonSchema(componentModel, componentOptions, endpointPaths, endpointOptions);
    writer.println(json);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:EndpointAnnotationProcessor.java


示例3: processEndpointClass

import org.apache.camel.spi.UriEndpoint; //导入依赖的package包/类
protected void processEndpointClass(final RoundEnvironment roundEnv, final TypeElement classElement) {
    final UriEndpoint uriEndpoint = classElement.getAnnotation(UriEndpoint.class);
    if (uriEndpoint != null) {
        String scheme = uriEndpoint.scheme();
        String extendsScheme = uriEndpoint.extendsScheme();
        String title = uriEndpoint.title();
        final String label = uriEndpoint.label();
        if (!isNullOrEmpty(scheme)) {
            // support multiple schemes separated by comma, which maps to the exact same component
            // for example camel-mail has a bunch of component schema names that does that
            String[] schemes = scheme.split(",");
            String[] titles = title.split(",");
            String[] extendsSchemes = extendsScheme != null ? extendsScheme.split(",") : null;
            for (int i = 0; i < schemes.length; i++) {
                final String alias = schemes[i];
                final String extendsAlias = extendsSchemes != null ? (i < extendsSchemes.length ? extendsSchemes[i] : extendsSchemes[0]) : null;
                final String aliasTitle = i < titles.length ? titles[i] : titles[0];
                // write html documentation
                String name = canonicalClassName(classElement.getQualifiedName().toString());
                String packageName = name.substring(0, name.lastIndexOf("."));
                String fileName = alias + ".html";
                Func1<PrintWriter, Void> handler = new Func1<PrintWriter, Void>() {
                    @Override
                    public Void call(PrintWriter writer) {
                        writeHtmlDocumentation(writer, roundEnv, classElement, uriEndpoint, aliasTitle, alias, extendsAlias, label);
                        return null;
                    }
                };
                processFile(packageName, fileName, handler);

                // write json schema
                fileName = alias + ".json";
                handler = new Func1<PrintWriter, Void>() {
                    @Override
                    public Void call(PrintWriter writer) {
                        writeJSonSchemeDocumentation(writer, roundEnv, classElement, uriEndpoint, aliasTitle, alias, extendsAlias, label);
                        return null;
                    }
                };
                processFile(packageName, fileName, handler);
            }
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:45,代码来源:EndpointAnnotationProcessor.java


示例4: writeHtmlDocumentation

import org.apache.camel.spi.UriEndpoint; //导入依赖的package包/类
protected void writeHtmlDocumentation(PrintWriter writer, RoundEnvironment roundEnv, TypeElement classElement, UriEndpoint uriEndpoint,
                                      String title, String scheme, String extendsScheme, String label) {
    // gather component information
    ComponentModel componentModel = findComponentProperties(roundEnv, uriEndpoint, classElement, title, scheme, extendsScheme, label);

    String syntax = componentModel.getSyntax();
    String alternativeSyntax = componentModel.getAlternativeSyntax();
    String description = componentModel.getDescription();

    writer.println("<html>");
    writer.println("<header>");
    writer.println("<title>" + title  + "</title>");
    writer.println("</header>");
    writer.println("<body>");
    writer.println("<h1>" + title + "</h1>");
    writer.println("<b>Scheme:</b> " + scheme + "<br/>");
    writer.println("<b>Syntax:</b> " + syntax + "<br/>");
    if (alternativeSyntax != null) {
        writer.println("<b>Alternative Syntax:</b> " + alternativeSyntax + "<br/>");
    }
    writer.println("<b>Description:</b> " + description + "<br/>");
    writer.println("<b>Deprecated:</b>" + componentModel.isDeprecated() + "<br/>");
    if (componentModel.isConsumerOnly()) {
        writer.println("<b>ConsumerOnly:</b>" + "true" + "<br/>");
    }
    if (componentModel.isProducerOnly()) {
        writer.println("<b>ProducerOnly:</b>" + "true" + "<br/>");
    }
    writer.println("<b>Async:</b>" + componentModel.isAsync() + "<br/>");
    writer.println("<b>Maven:</b> " + componentModel.getGroupId() + "/" + componentModel.getArtifactId() + "/" + componentModel.getVersionId() + "<br/>");

    writeHtmlDocumentationAndFieldInjections(writer, roundEnv, componentModel, classElement, "", uriEndpoint.excludeProperties());

    // This code is not my fault, it seems to honestly be the hacky way to find a class name in APT :)
    TypeMirror consumerType = null;
    try {
        uriEndpoint.consumerClass();
    } catch (MirroredTypeException mte) {
        consumerType = mte.getTypeMirror();
    }

    boolean found = false;
    String consumerClassName = null;
    String consumerPrefix = getOrElse(uriEndpoint.consumerPrefix(), "");
    if (consumerType != null) {
        consumerClassName = consumerType.toString();
        TypeElement consumerElement = findTypeElement(roundEnv, consumerClassName);
        if (consumerElement != null) {
            writer.println("<h2>" + scheme + " consumer" + "</h2>");
            writeHtmlDocumentationAndFieldInjections(writer, roundEnv, componentModel, consumerElement, consumerPrefix, uriEndpoint.excludeProperties());
            found = true;
        }
    }
    if (!found && consumerClassName != null) {
        warning("APT could not find consumer class " + consumerClassName);
    }
    writer.println("</body>");
    writer.println("</html>");
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:60,代码来源:EndpointAnnotationProcessor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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