camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: Fixed camel model json schema to include missing namespace aware languages.
Date Thu, 15 Oct 2015 11:51:48 GMT
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/84281b41
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/84281b41
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/84281b41

Branch: refs/heads/camel-2.15.x
Commit: 84281b415dd3747cf2f1f8b4e247f6be4dd92fbc
Parents: aca7225
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Oct 15 13:53:08 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Oct 15 13:54:01 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/84281b41/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 c02c7c5..4dc7db0 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
@@ -58,7 +58,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",
@@ -430,18 +433,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);
+                            }
                         }
                     }
                 }
@@ -716,17 +721,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);
+                        }
                     }
                 }
             }
@@ -1058,4 +1065,4 @@ public class EipAnnotationProcessor extends AbstractAnnotationProcessor
{
         }
     }
 
-}
\ No newline at end of file
+}


Mime
View raw message