camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r954881 - /camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
Date Tue, 15 Jun 2010 13:44:01 GMT
Author: jstrachan
Date: Tue Jun 15 13:44:01 2010
New Revision: 954881

URL: http://svn.apache.org/viewvc?rev=954881&view=rev
Log:
added a helper method to make it easy to build up camel routes generically with reflection
from inside Scala code. The current ProcessorDefinition type declaration, being recursive,
seems to cause some issues when trying to use the typesafe APIs in Scala on a ProcessorDefintion
to add a new step. One day we maybe should introduce a super type below ProcessorDefintion
which is a simple non-recursive generic type so it can be easily used from both java and scala
without hitting our heads on generics pain & only using these complex recursive generic
types for the return values of typesafe DSL methods.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=954881&r1=954880&r2=954881&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Tue
Jun 15 13:44:01 2010
@@ -141,6 +141,20 @@ public abstract class ProcessorDefinitio
         return children;
     }
 
+    /**
+     * A helper method to add an output node to this processor definition which can avoid
the use of hairy generics
+     * when using Scala code
+     */
+    public boolean addOutputObject(Object node) {
+        if (node instanceof ProcessorDefinition) {
+            addOutput((ProcessorDefinition) node);
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
     public void addOutput(ProcessorDefinition processorType) {
         processorType.setParent(this);
         configureChild(processorType);



Mime
View raw message