本文整理汇总了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;
}
示例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);
}
示例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);
}
}
}
}
示例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>");
}