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 2015/10/15 13:51:47 UTC
[2/3] camel git commit: Fixed camel model json schema to include
missing namespace aware languages.
Fixed camel model json schema to include missing namespace aware languages.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0ec9813d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0ec9813d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0ec9813d
Branch: refs/heads/camel-2.16.x
Commit: 0ec9813dc18c6ac362febbc8b368fa93f04756a5
Parents: ec4919b
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Oct 15 13:53:08 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Oct 15 13:53:38 2015 +0200
----------------------------------------------------------------------
.../camel/tools/apt/EipAnnotationProcessor.java | 57 +++++++++++---------
1 file changed, 32 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/0ec9813d/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 d9aca0a..dfa5763 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
@@ -59,7 +59,10 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
// special when using expression/predicates in the model
private static final String ONE_OF_TYPE_NAME = "org.apache.camel.model.ExpressionSubElementDefinition";
- private static final String ONE_OF_LANGUAGES = "org.apache.camel.model.language.ExpressionDefinition";
+ private static final String[] ONE_OF_LANGUAGES = new String[]{
+ "org.apache.camel.model.language.ExpressionDefinition",
+ "org.apache.camel.model.language.NamespaceAwareExpression"
+ };
// special for inputs (these classes have sub classes, so we use this to find all classes)
private static final String[] ONE_OF_INPUTS = new String[]{
"org.apache.camel.model.ProcessorDefinition",
@@ -439,18 +442,20 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
if (isOneOf) {
// okay its actually an language expression, so favor using that in the eip option
kind = "expression";
- fieldTypeName = ONE_OF_LANGUAGES;
- TypeElement languages = findTypeElement(roundEnv, ONE_OF_LANGUAGES);
- String superClassName = canonicalClassName(languages.toString());
- // find all classes that has that superClassName
- Set<TypeElement> children = new LinkedHashSet<TypeElement>();
- findTypeElementChildren(roundEnv, children, superClassName);
- for (TypeElement child : children) {
- XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
- if (rootElement != null) {
- String childName = rootElement.name();
- if (childName != null) {
- oneOfTypes.add(childName);
+ for (String language : ONE_OF_LANGUAGES) {
+ fieldTypeName = language;
+ TypeElement languages = findTypeElement(roundEnv, language);
+ String superClassName = canonicalClassName(languages.toString());
+ // find all classes that has that superClassName
+ Set<TypeElement> children = new LinkedHashSet<TypeElement>();
+ findTypeElementChildren(roundEnv, children, superClassName);
+ for (TypeElement child : children) {
+ XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ String childName = rootElement.name();
+ if (childName != null) {
+ oneOfTypes.add(childName);
+ }
}
}
}
@@ -772,17 +777,19 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
// gather oneOf expression/predicates which uses language
Set<String> oneOfTypes = new TreeSet<String>();
- TypeElement languages = findTypeElement(roundEnv, ONE_OF_LANGUAGES);
- String superClassName = canonicalClassName(languages.toString());
- // find all classes that has that superClassName
- Set<TypeElement> children = new LinkedHashSet<TypeElement>();
- findTypeElementChildren(roundEnv, children, superClassName);
- for (TypeElement child : children) {
- XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
- if (rootElement != null) {
- String childName = rootElement.name();
- if (childName != null) {
- oneOfTypes.add(childName);
+ for (String language : ONE_OF_LANGUAGES) {
+ TypeElement languages = findTypeElement(roundEnv, language);
+ String superClassName = canonicalClassName(languages.toString());
+ // find all classes that has that superClassName
+ Set<TypeElement> children = new LinkedHashSet<TypeElement>();
+ findTypeElementChildren(roundEnv, children, superClassName);
+ for (TypeElement child : children) {
+ XmlRootElement rootElement = child.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ String childName = rootElement.name();
+ if (childName != null) {
+ oneOfTypes.add(childName);
+ }
}
}
}
@@ -1118,4 +1125,4 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor {
}
}
-}
\ No newline at end of file
+}