You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/25 16:26:25 UTC
[2/2] camel git commit: CAMEL-9531: Camel catalog - method call,
tokenizer and xtokenizer do not use @XmlValue.
CAMEL-9531: Camel catalog - method call, tokenizer and xtokenizer do not use @XmlValue.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aeb27630
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aeb27630
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aeb27630
Branch: refs/heads/camel-2.16.x
Commit: aeb276300c0485c3810611fa96345e4d2ae7fa7e
Parents: 67c986c
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Jan 25 16:25:57 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Jan 25 16:26:15 2016 +0100
----------------------------------------------------------------------
.../camel/tools/apt/EipAnnotationProcessor.java | 25 +++++++++++++-------
1 file changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/aeb27630/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
----------------------------------------------------------------------
diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
index eadb6fe..2097916 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EipAnnotationProcessor.java
@@ -159,13 +159,13 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
}
protected void writeJSonSchemeDocumentation(PrintWriter writer, RoundEnvironment roundEnv, TypeElement classElement, XmlRootElement rootElement,
- String javaTypeName, String name) {
+ String javaTypeName, String modelName) {
// gather eip information
- EipModel eipModel = findEipModelProperties(roundEnv, classElement, javaTypeName, name);
+ EipModel eipModel = findEipModelProperties(roundEnv, classElement, javaTypeName, modelName);
// get endpoint information which is divided into paths and options (though there should really only be one path)
Set<EipOption> eipOptions = new TreeSet<EipOption>(new EipOptionComparator(eipModel));
- findClassProperties(writer, roundEnv, eipOptions, classElement, classElement, "");
+ findClassProperties(writer, roundEnv, eipOptions, classElement, classElement, "", modelName);
// after we have found all the options then figure out if the model accepts input/output
eipModel.setInput(hasInput(roundEnv, classElement));
@@ -251,7 +251,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
}
protected void findClassProperties(PrintWriter writer, RoundEnvironment roundEnv, Set<EipOption> eipOptions,
- TypeElement originalClassType, TypeElement classElement, String prefix) {
+ TypeElement originalClassType, TypeElement classElement, String prefix, String modelName) {
while (true) {
List<VariableElement> fieldElements = ElementFilter.fieldsIn(classElement.getEnclosedElements());
for (VariableElement fieldElement : fieldElements) {
@@ -260,7 +260,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
XmlAttribute attribute = fieldElement.getAnnotation(XmlAttribute.class);
if (attribute != null) {
- boolean skip = processAttribute(roundEnv, originalClassType, classElement, fieldElement, fieldName, attribute, eipOptions, prefix);
+ boolean skip = processAttribute(roundEnv, originalClassType, classElement, fieldElement, fieldName, attribute, eipOptions, prefix, modelName);
if (skip) {
continue;
}
@@ -268,7 +268,7 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
XmlValue value = fieldElement.getAnnotation(XmlValue.class);
if (value != null) {
- processValue(roundEnv, originalClassType, classElement, fieldElement, fieldName, value, eipOptions, prefix);
+ processValue(roundEnv, originalClassType, classElement, fieldElement, fieldName, value, eipOptions, prefix, modelName);
}
XmlElements elements = fieldElement.getAnnotation(XmlElements.class);
@@ -328,8 +328,8 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
}
}
- private boolean processAttribute(RoundEnvironment roundEnv, TypeElement originalClassType, TypeElement classElement, VariableElement fieldElement, String fieldName, XmlAttribute attribute,
- Set<EipOption> eipOptions, String prefix) {
+ private boolean processAttribute(RoundEnvironment roundEnv, TypeElement originalClassType, TypeElement classElement, VariableElement fieldElement,
+ String fieldName, XmlAttribute attribute, Set<EipOption> eipOptions, String prefix, String modelName) {
Elements elementUtils = processingEnv.getElementUtils();
String name = attribute.name();
@@ -381,12 +381,19 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
}
private void processValue(RoundEnvironment roundEnv, TypeElement originalClassType, TypeElement classElement, VariableElement fieldElement, String fieldName, XmlValue value,
- Set<EipOption> eipOptions, String prefix) {
+ Set<EipOption> eipOptions, String prefix, String modelName) {
Elements elementUtils = processingEnv.getElementUtils();
// XmlValue has no name attribute
String name = fieldName;
+ if ("method".equals(modelName) || "tokenize".equals(modelName) || "xtokenize".equals(modelName)) {
+ // skip expression attribute on these three languages as they are solely configured using attributes
+ if ("expression".equals(name)) {
+ return;
+ }
+ }
+
name = prefix + name;
TypeMirror fieldType = fieldElement.asType();
String fieldTypeName = fieldType.toString();