camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1243236 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/model/language/ camel-core/src/test/java/org/apache/camel/issues/
Date Sun, 12 Feb 2012 10:51:49 GMT
Author: davsclaus
Date: Sun Feb 12 10:51:49 2012
New Revision: 1243236

URL: http://svn.apache.org/viewvc?rev=1243236&view=rev
Log:
CAMEL-4997: Improved method call expression to detect class type passed in as an instance
due Object type.

Added:
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/MethodClassByTypeIssueTest.java
      - copied unchanged from r1243234, camel/trunk/camel-core/src/test/java/org/apache/camel/issues/MethodClassByTypeIssueTest.java
    camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/MyTransformBean.java
      - copied unchanged from r1243234, camel/trunk/camel-core/src/test/java/org/apache/camel/issues/MyTransformBean.java
Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Feb 12 10:51:49 2012
@@ -1 +1 @@
-/camel/trunk:1243046,1243057
+/camel/trunk:1243046,1243057,1243234

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java?rev=1243236&r1=1243235&r2=1243236&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
Sun Feb 12 10:51:49 2012
@@ -75,8 +75,9 @@ public class MethodCallExpression extend
     
     public MethodCallExpression(Object instance, String method) {
         super(ObjectHelper.className(instance));
-        this.instance = instance;
-        this.method = method;
+        // must use setter as they have special logic
+        setInstance(instance);
+        setMethod(method);
     }
 
     public MethodCallExpression(Class<?> type) {
@@ -123,6 +124,7 @@ public class MethodCallExpression extend
 
     public void setBeanType(Class<?> beanType) {
         this.beanType = beanType;
+        this.instance = null;
     }
 
     public String getBeanTypeName() {
@@ -138,7 +140,14 @@ public class MethodCallExpression extend
     }
 
     public void setInstance(Object instance) {
-        this.instance = instance;
+        // people may by mistake pass in a class type as the instance
+        if (instance instanceof Class) {
+            this.beanType = (Class<?>) instance;
+            this.instance = null;
+        } else {
+            this.beanType = null;
+            this.instance = instance;
+        }
     }
 
     @Override



Mime
View raw message