You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cm...@apache.org on 2011/01/16 09:26:09 UTC

svn commit: r1059512 - in /camel/trunk: ./ camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/component/bean/ camel-core/src/main/java/org/apache/camel/language/bean/ ...

Author: cmueller
Date: Sun Jan 16 08:26:08 2011
New Revision: 1059512

URL: http://svn.apache.org/viewvc?rev=1059512&view=rev
Log:
Reverted changes for CAMEL-3311

Added:
    camel/trunk/diff_1056749_1056745.txt   (with props)
Removed:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterTypeTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MethodNotFoundExceptionTest.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanParameterTypeSpringTest.java
    camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/MyDummyBean.java
    camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/bean/BeanParameterTypeSpringTest-context.xml
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/RuntimeBeanExpressionException.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyDummyBean.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Sun Jan 16 08:26:08 2011
@@ -84,7 +84,6 @@ public interface Exchange {
     String BATCH_COMPLETE             = "CamelBatchComplete";
     String BEAN_METHOD_NAME           = "CamelBeanMethodName";
     String BEAN_MULTI_PARAMETER_ARRAY = "CamelBeanMultiParameterArray";
-    String BEAN_TYPE_NAME             = "CamelBeanTypeName";
     String BINDING                    = "CamelBinding";
 
     String CHARSET_NAME      = "CamelCharsetName";

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java Sun Jan 16 08:26:08 2011
@@ -211,22 +211,6 @@ public class ExpressionClause<T> extends
      * href="http://camel.apache.org/bean-language.html>bean language</a>
      * which basically means the bean is invoked to determine the expression
      * value.
-     * 
-     * @param bean the name of the bean looked up the registry
-     * @param method the name of the method to invoke on the bean
-     * @param parameterType the parameter type of the method to invoke on the bean
-     * @return the builder to continue processing the DSL
-     */
-    @SuppressWarnings("rawtypes")
-    public T method(String bean, String method, Class parameterType) {
-        return delegate.method(bean, method, parameterType);
-    }
-    
-    /**
-     * Evaluates an expression using the <a
-     * href="http://camel.apache.org/bean-language.html>bean language</a>
-     * which basically means the bean is invoked to determine the expression
-     * value.
      *
      * @param instance the instance of the bean
      * @param method the name of the method to invoke on the bean
@@ -235,21 +219,6 @@ public class ExpressionClause<T> extends
     public T method(Object instance, String method) {
         return delegate.method(instance, method);
     }
-    
-    /**
-     * Evaluates an expression using the <a
-     * href="http://camel.apache.org/bean-language.html>bean language</a>
-     * which basically means the bean is invoked to determine the expression
-     * value.
-     *
-     * @param instance the instance of the bean
-     * @param method the name of the method to invoke on the bean
-     * @param parameterType the parameter type of the method to invoke on the bean
-     * @return the builder to continue processing the DSL
-     */
-    public T method(Object instance, String method, Class parameterType) {
-        return delegate.method(instance, method, parameterType);
-    }
 
     /**
      * Evaluates an expression using the <a
@@ -264,21 +233,6 @@ public class ExpressionClause<T> extends
     public T method(Class<?> beanType, String method) {
         return delegate.method(beanType, method);
     }
-    
-    /**
-     * Evaluates an expression using the <a
-     * href="http://camel.apache.org/bean-language.html>bean language</a>
-     * which basically means the bean is invoked to determine the expression
-     * value.
-     * 
-     * @param beanType the Class of the bean which we want to invoke
-     * @param method the name of the method to invoke on the bean
-     * @param parameterType the parameter type of the method to invoke on the bean
-     * @return the builder to continue processing the DSL
-     */
-    public T method(Class<?> beanType, String method, Class parameterType) {
-        return delegate.method(beanType, method, parameterType);
-    }
 
     /**
      * Evaluates the <a href="http://camel.apache.org/el.html">EL

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java Sun Jan 16 08:26:08 2011
@@ -235,24 +235,6 @@ public class ExpressionClauseSupport<T> 
         setExpressionType(expression);
         return result;
     }
-    
-    /**
-     * Evaluates an expression using the <a
-     * href="http://camel.apache.org/bean-language.html>bean language</a>
-     * which basically means the bean is invoked to determine the expression
-     * value.
-     *
-     * @param instance the instance of the bean
-     * @param method the name of the method to invoke on the bean
-     * @param parameterType the parameter type of the method to invoke on the bean
-     * @return the builder to continue processing the DSL
-     */
-    @SuppressWarnings("rawtypes")
-    public T method(Object instance, String method, Class parameterType) {
-        MethodCallExpression expression = new MethodCallExpression(instance, method, parameterType);
-        setExpressionType(expression);
-        return result;
-    }
 
     /**
      * Evaluates an expression using the <a
@@ -269,24 +251,6 @@ public class ExpressionClauseSupport<T> 
         setExpressionType(expression);
         return result;
     }
-    
-    /**
-     * Evaluates an expression using the <a
-     * href="http://camel.apache.org/bean-language.html>bean language</a>
-     * which basically means the bean is invoked to determine the expression
-     * value.
-     *
-     * @param beanType the Class of the bean which we want to invoke
-     * @param method the name of the method to invoke on the bean
-     * @param parameterType the parameter type of the method to invoke on the bean
-     * @return the builder to continue processing the DSL
-     */
-    @SuppressWarnings("rawtypes")
-    public T method(Class<?> beanType, String method, Class parameterType) {
-        MethodCallExpression expression = new MethodCallExpression(beanType, method, parameterType);
-        setExpressionType(expression);
-        return result;
-    }
 
     /**
      * Evaluates the <a href="http://camel.apache.org/el.html">EL

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java Sun Jan 16 08:26:08 2011
@@ -129,12 +129,10 @@ public class BeanInfo {
         return null;
     }
 
-    @SuppressWarnings("rawtypes")
     public MethodInvocation createInvocation(Object pojo, Exchange exchange) throws AmbiguousMethodCallException, MethodNotFoundException {
         MethodInfo methodInfo = null;
 
         String name = exchange.getIn().getHeader(Exchange.BEAN_METHOD_NAME, String.class);
-        Class type = exchange.getIn().getHeader(Exchange.BEAN_TYPE_NAME, Class.class);
         if (name != null) {
             if (hasMethod(name)) {
                 List<MethodInfo> methods = getOperations(name);
@@ -145,7 +143,7 @@ public class BeanInfo {
                     // there are more methods with that name so we cannot decide which to use
 
                     // but first lets try to choose a method and see if that comply with the name
-                    methodInfo = chooseMethod(pojo, exchange, name, type);
+                    methodInfo = chooseMethod(pojo, exchange, name);
                     if (methodInfo == null || !name.equals(methodInfo.getMethod().getName())) {
                         throw new AmbiguousMethodCallException(exchange, methods);
                     }
@@ -157,7 +155,7 @@ public class BeanInfo {
         }
         if (methodInfo == null) {
             // no name or type
-            methodInfo = chooseMethod(pojo, exchange, null, null);
+            methodInfo = chooseMethod(pojo, exchange, null);
         }
         if (methodInfo == null) {
             methodInfo = defaultMethod;
@@ -283,7 +281,7 @@ public class BeanInfo {
         return answer;
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @SuppressWarnings("unchecked")
     protected MethodInfo createMethodInfo(Class clazz, Method method) {
         Class[] parameterTypes = method.getParameterTypes();
         Annotation[][] parametersAnnotations = method.getParameterAnnotations();
@@ -352,17 +350,15 @@ public class BeanInfo {
      * @param pojo the bean to invoke a method on
      * @param exchange the message exchange
      * @param name an optional name of the method that must match, use <tt>null</tt> to indicate all methods
-     * @param parameterType an optional type of the method parameter that must match, use <tt>null</tt> to indicate all types
      * @return the method to invoke or null if no definitive method could be matched
      * @throws AmbiguousMethodCallException is thrown if cannot chose method due to ambiguous
      */
-    @SuppressWarnings("rawtypes")
-    protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String name, Class parameterType) throws AmbiguousMethodCallException {
+    protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String name) throws AmbiguousMethodCallException {
         // @Handler should be select first
         // then any single method that has a custom @annotation
         // or any single method that has a match parameter type that matches the Exchange payload
         // and last then try to select the best among the rest
-        
+
         if (name != null) {
             // filter all lists to only include methods with this name
             removeNonMatchingMethods(operationsWithHandlerAnnotation, name);
@@ -374,13 +370,6 @@ public class BeanInfo {
             removeAllSetterOrGetterMethods(operationsWithCustomAnnotation);
             removeAllSetterOrGetterMethods(operationsWithBody);
         }
-        
-        if (parameterType != null) {
-            // filter all lists to only include methods with this argument type
-            removeNonMatchingMethods(operationsWithHandlerAnnotation, parameterType);
-            removeNonMatchingMethods(operationsWithCustomAnnotation, parameterType);
-            removeNonMatchingMethods(operationsWithBody, parameterType);
-        }
 
         if (operationsWithHandlerAnnotation.size() > 1) {
             // if we have more than 1 @Handler then its ambiguous
@@ -416,7 +405,6 @@ public class BeanInfo {
         return null;
     }
     
-    @SuppressWarnings("rawtypes")
     private MethodInfo chooseMethodWithMatchingBody(Exchange exchange, Collection<MethodInfo> operationList)
         throws AmbiguousMethodCallException {
         // lets see if we can find a method who's body param type matches the message body
@@ -678,19 +666,6 @@ public class BeanInfo {
             }
         }
     }
-    
-    @SuppressWarnings("rawtypes")
-    private static void removeNonMatchingMethods(List<MethodInfo> methods, Class type) {
-        Iterator<MethodInfo> it = methods.iterator();
-        while (it.hasNext()) {
-            MethodInfo info = it.next();
-            Class<?>[] parameterTypes = info.getMethod().getParameterTypes();
-            if (!(parameterTypes.length > 0 && parameterTypes[0].isAssignableFrom(type))) {
-                // type does not match so remove it
-                it.remove();
-            }
-        }
-    }
 
     private static Class<?> getTargetClass(Class<?> clazz) {
         if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {
@@ -712,51 +687,7 @@ public class BeanInfo {
      * @return <tt>true</tt> if we have such a method.
      */
     public boolean hasMethod(String methodName) {
-        return hasMethod(methodName, null);
-    }
-    
-    /**
-     * Do we have a method with the given name.
-     * <p/>
-     * Shorthand method names for getters is supported, so you can pass in eg 'name' and Camel
-     * will can find the real 'getName' method instead.
-     *
-     * @param methodName the method name
-     * @param parameterTypes the parameter types
-     * @return <tt>true</tt> if we have such a method.
-     */
-    @SuppressWarnings("rawtypes")
-    public boolean hasMethod(String methodName, List<Class> parameterTypes) {
-        List<MethodInfo> methods = getOperations(methodName);
-        if (methods == null || methods.isEmpty()) {
-            return false;
-        }
-        
-        if (parameterTypes == null || parameterTypes.isEmpty()) {
-            return true;
-        }
-        
-        for (MethodInfo methodInfo : methods) {
-            List<ParameterInfo> parameters = methodInfo.getParameters();
-            
-            if (parameters.size() == parameterTypes.size()) {
-                Iterator<Class> parameterTypesIterator = parameterTypes.iterator();
-                boolean matchingMethodFound = true;
-                
-                for (ParameterInfo parameterInfo : parameters) {
-                    if (!parameterInfo.getType().isAssignableFrom(parameterTypesIterator.next())) {
-                        matchingMethodFound = false;
-                        break; 
-                    }
-                }
-                
-                if (matchingMethodFound) {
-                    return true;
-                }
-            }
-        }
-        
-        return false;
+        return getOperations(methodName) != null;
     }
 
     /**

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java Sun Jan 16 08:26:08 2011
@@ -47,8 +47,6 @@ public class BeanProcessor extends Servi
     private String method;
     private BeanHolder beanHolder;
     private boolean shorthandMethod;
-    @SuppressWarnings("rawtypes")
-    private Class parameterType;
 
     public BeanProcessor(Object pojo, BeanInfo beanInfo) {
         this(new ConstantBeanHolder(pojo, beanInfo));
@@ -76,13 +74,9 @@ public class BeanProcessor extends Servi
         AsyncProcessorHelper.process(this, exchange);
     }
 
-    @SuppressWarnings({ "rawtypes" })
     public boolean process(Exchange exchange, AsyncCallback callback) {
         // do we have an explicit method name we always should invoke
         boolean isExplicitMethod = ObjectHelper.isNotEmpty(method);
-        // do we have an explicit parameter type we should invoke if we have multiple possible
-        // methods
-        boolean isExplicitParameterType = ObjectHelper.isNotEmpty(parameterType);
 
         Object bean = beanHolder.getBean();
         BeanInfo beanInfo = beanHolder.getBeanInfo();
@@ -104,7 +98,7 @@ public class BeanProcessor extends Servi
         }
 
         Message in = exchange.getIn();
-        
+
         // Now it gets a bit complicated as ProxyHelper can proxy beans which we later
         // intend to invoke (for example to proxy and invoke using spring remoting).
         // and therefore the message body contains a BeanInvocation object.
@@ -128,14 +122,13 @@ public class BeanProcessor extends Servi
                 return true;
             }
         }
-        
+
         // set temporary header which is a hint for the bean info that introspect the bean
         if (in.getHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY) == null) {
             in.setHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, isMultiParameterArray());
         }
 
         String prevMethod = null;
-        Class prevType = null;
         MethodInvocation invocation;
         if (methodObject != null) {
             invocation = beanInfo.createInvocation(methodObject, bean, exchange);
@@ -145,10 +138,6 @@ public class BeanProcessor extends Servi
                 prevMethod = in.getHeader(Exchange.BEAN_METHOD_NAME, String.class);
                 in.setHeader(Exchange.BEAN_METHOD_NAME, method);
             }
-            if (isExplicitParameterType) {
-                prevType = in.getHeader(Exchange.BEAN_TYPE_NAME, Class.class);
-                in.setHeader(Exchange.BEAN_TYPE_NAME, parameterType);
-            }
             try {
                 invocation = beanInfo.createInvocation(bean, exchange);
             } catch (Throwable e) {
@@ -193,9 +182,6 @@ public class BeanProcessor extends Servi
             if (isExplicitMethod) {
                 in.setHeader(Exchange.BEAN_METHOD_NAME, prevMethod);
             }
-            if (isExplicitParameterType) {
-                in.setHeader(Exchange.BEAN_TYPE_NAME, prevType);
-            }
         }
 
         // if the method returns something then set the value returned on the Exchange
@@ -272,21 +258,6 @@ public class BeanProcessor extends Servi
     public void setShorthandMethod(boolean shorthandMethod) {
         this.shorthandMethod = shorthandMethod;
     }
-    
-    @SuppressWarnings("rawtypes")
-    public Class getParameterType() {
-        return parameterType;
-    }
-
-    /**
-     * Sets the parameter type/class name to which the body should converted before the suitable method is
-     * determined.
-     * @param parameterType
-     */
-    @SuppressWarnings("rawtypes")
-    public void setParameterType(Class parameterType) {
-        this.parameterType = parameterType;
-    }
 
     // Implementation methods
     //-------------------------------------------------------------------------

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodNotFoundException.java Sun Jan 16 08:26:08 2011
@@ -30,21 +30,12 @@ public class MethodNotFoundException ext
     private final Object bean;
     private final String methodName;
     @SuppressWarnings("rawtypes")
-    private List<Class> parameterTypes;
 
     public MethodNotFoundException(Exchange exchange, Object pojo, String methodName) {
         super("Method with name: " + methodName + " not found on bean: " + pojo, exchange);
         this.methodName = methodName;
         this.bean = pojo;
     }
-    
-    @SuppressWarnings("rawtypes")
-    public MethodNotFoundException(Exchange exchange, Object pojo, String methodName, List<Class> parameterTypes) {
-        super("Method with name: " + methodName + " and parameter types: " + parameterTypes + " not found on bean: " + pojo, exchange);
-        this.methodName = methodName;
-        this.bean = pojo;
-        this.parameterTypes = parameterTypes;
-    }
 
     public MethodNotFoundException(Object pojo, String methodName, Throwable cause) {
         super("Method with name: " + methodName + " not found on bean: " + pojo, null, cause);
@@ -59,9 +50,4 @@ public class MethodNotFoundException ext
     public Object getBean() {
         return bean;
     }
-
-    @SuppressWarnings("rawtypes")
-    public List<Class> getParameterTypes() {
-        return parameterTypes;
-    }
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/BeanExpression.java Sun Jan 16 08:26:08 2011
@@ -42,34 +42,20 @@ public class BeanExpression implements E
     private String beanName;
     private String method;
     private Object bean;
-    @SuppressWarnings("rawtypes")
-    private Class parameterType;
-    
-    public BeanExpression(Object bean, String method) {
-        this(bean, method, null);
-    }
 
-    @SuppressWarnings("rawtypes")
-    public BeanExpression(Object bean, String method, Class parameterType) {
+    public BeanExpression(Object bean, String method) {
         this.bean = bean;
         this.method = method;
-        this.parameterType = parameterType;
     }
 
     public BeanExpression(String beanName, String method) {
-        this(beanName, method, null);
-    }
-    
-    @SuppressWarnings("rawtypes")
-    public BeanExpression(String beanName, String method, Class parameterType) {
         this.beanName = beanName;
         this.method = method;
-        this.parameterType = parameterType;
     }
 
     @Override
     public String toString() {
-        return "BeanExpression[bean:" + (bean == null ? beanName : bean) + " method: " + method + " parameterType: " + parameterType + "]";
+        return "BeanExpression[bean:" + (bean == null ? beanName : bean) + " method: " + method + "]";
     }
 
     public Object evaluate(Exchange exchange) {
@@ -86,7 +72,7 @@ public class BeanExpression implements E
         // validate OGNL
         if (OgnlHelper.isInvalidValidOgnlExpression(method)) {
             ExpressionIllegalSyntaxException cause = new ExpressionIllegalSyntaxException(method);
-            throw new RuntimeBeanExpressionException(exchange, beanName, method, parameterType, cause);
+            throw new RuntimeBeanExpressionException(exchange, beanName, method, cause);
         }
 
         if (OgnlHelper.isValidOgnlExpression(method)) {
@@ -97,16 +83,16 @@ public class BeanExpression implements E
                 ognl.process(exchange);
                 return ognl.getResult();
             } catch (Exception e) {
-                throw new RuntimeBeanExpressionException(exchange, beanName, method, parameterType, e);
+                throw new RuntimeBeanExpressionException(exchange, beanName, method, e);
             }
         } else {
             // regular non ognl invocation
-            InvokeProcessor invoke = new InvokeProcessor(holder, method, parameterType);
+            InvokeProcessor invoke = new InvokeProcessor(holder, method);
             try {
                 invoke.process(exchange);
                 return invoke.getResult();
             } catch (Exception e) {
-                throw new RuntimeBeanExpressionException(exchange, beanName, method, parameterType, e);
+                throw new RuntimeBeanExpressionException(exchange, beanName, method, e);
             }
         }
     }
@@ -128,17 +114,11 @@ public class BeanExpression implements E
 
         private BeanHolder beanHolder;
         private String methodName;
-        private Class parameterType;
         private Object result;
 
         private InvokeProcessor(BeanHolder beanHolder, String methodName) {
-            this(beanHolder, methodName, null);
-        }
-        
-        private InvokeProcessor(BeanHolder beanHolder, String methodName, Class parameterType) {
             this.beanHolder = beanHolder;
             this.methodName = methodName;
-            this.parameterType = parameterType;
         }
 
         public void process(Exchange exchange) throws Exception {
@@ -148,9 +128,6 @@ public class BeanExpression implements E
                 // enable OGNL like invocation
                 processor.setShorthandMethod(true);
             }
-            if (parameterType != null) {
-                processor.setParameterType(parameterType);
-            }
             try {
                 // copy the original exchange to avoid side effects on it
                 Exchange resultExchange = exchange.copy();
@@ -164,7 +141,7 @@ public class BeanExpression implements E
                     exchange.setException(resultExchange.getException());
                 }
             } catch (Exception e) {
-                throw new RuntimeBeanExpressionException(exchange, beanName, methodName, parameterType, e);
+                throw new RuntimeBeanExpressionException(exchange, beanName, methodName, e);
             }
         }
 
@@ -252,7 +229,6 @@ public class BeanExpression implements E
             }
         }
 
-        @SuppressWarnings("rawtypes")
         private Object lookupResult(Exchange exchange, String key, Object result, boolean nullSafe, String ognlPath, Object bean) {
             // trim key
             key = key.trim();
@@ -308,4 +284,5 @@ public class BeanExpression implements E
             return result;
         }
     }
-}
\ No newline at end of file
+
+}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/RuntimeBeanExpressionException.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/RuntimeBeanExpressionException.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/RuntimeBeanExpressionException.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/language/bean/RuntimeBeanExpressionException.java Sun Jan 16 08:26:08 2011
@@ -30,24 +30,12 @@ public class RuntimeBeanExpressionExcept
     private final Exchange exchange;
     private final String beanName;
     private final String method;
-    @SuppressWarnings("rawtypes")
-    private final Class parameterType;
 
     public RuntimeBeanExpressionException(Exchange exchange, String beanName, String method, Throwable e) {
         super("Failed to invoke method: " + method + " on " + beanName + " due to: " + e, e);
         this.exchange = exchange;
         this.beanName = beanName;
         this.method = method;
-        this.parameterType = null;
-    }
-    
-    @SuppressWarnings("rawtypes")
-    public RuntimeBeanExpressionException(Exchange exchange, String beanName, String method, Class parameterType, Throwable e) {
-        super("Failed to invoke method: " + method + " with parameter type: " + parameterType + " on " + beanName + " due to: " + e, e);
-        this.exchange = exchange;
-        this.beanName = beanName;
-        this.method = method;
-        this.parameterType = parameterType;
     }
 
     public String getBeanName() {
@@ -61,9 +49,4 @@ public class RuntimeBeanExpressionExcept
     public String getMethod() {
         return method;
     }
-    
-    @SuppressWarnings("rawtypes")
-    public Class getParameterType() {
-        return parameterType;
-    }
-}
\ No newline at end of file
+}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/BeanDefinition.java Sun Jan 16 08:26:08 2011
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.model;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -49,8 +46,6 @@ public class BeanDefinition extends Outp
     private String method;
     @XmlAttribute(required = false)
     private Class<?> beanType;
-    @XmlAttribute(required = false)
-    private Class<?> parameterType;
     @XmlTransient
     private Object bean;
 
@@ -65,12 +60,6 @@ public class BeanDefinition extends Outp
         this.ref = ref;
         this.method = method;
     }
-    
-    public BeanDefinition(String ref, String method, Class<?> parameterType) {
-        this.ref = ref;
-        this.method = method;
-        this.parameterType = parameterType;
-    }
 
     @Override
     public String toString() {
@@ -111,14 +100,6 @@ public class BeanDefinition extends Outp
         this.beanType = beanType;
     }
     
-    public Class<?> getParameterType() {
-        return parameterType;
-    }
-
-    public void setParameterType(Class<?> parameterType) {
-        this.parameterType = parameterType;
-    }
-    
     // Fluent API
     //-------------------------------------------------------------------------
     /**
@@ -164,19 +145,7 @@ public class BeanDefinition extends Outp
         setBean(beanType);
         return this;
     }
-    
-    /**
-     * Sets the Class of the method parameter that camel will call
-     *
-     * @param parameterType the Class of the method parameter
-     * @return the builder
-     */
-    public BeanDefinition parameterType(Class<?> parameterType) {
-        setParameterType(parameterType);
-        return this;
-    }
 
-    @SuppressWarnings("rawtypes")
     @Override
     public Processor createProcessor(RouteContext routeContext) {
         BeanProcessor answer;
@@ -202,21 +171,11 @@ public class BeanDefinition extends Outp
         }
         if (method != null) {
             answer.setMethod(method);
-            
+
             // check there is a method with the given name, and leverage BeanInfo for that
             BeanInfo info = new BeanInfo(routeContext.getCamelContext(), bean.getClass());
-            if (parameterType != null) {
-                answer.setParameterType(parameterType);
-                
-                List<Class> parameterTypes = new ArrayList<Class>();
-                parameterTypes.add(parameterType);
-                if (!info.hasMethod(method, parameterTypes)) {
-                    throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method, parameterTypes));
-                }
-            } else {
-                if (!info.hasMethod(method)) {
-                    throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
-                }
+            if (!info.hasMethod(method)) {
+                throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
             }
         }
         return answer;
@@ -229,9 +188,6 @@ public class BeanDefinition extends Outp
             if (method != null) {
                 methodText = " method: " + method;
             }
-            if (parameterType != null) {
-                methodText = methodText + " parameterType: " + parameterType;
-            }
             return "ref:" + ref + methodText;
         } else if (bean != null) {
             return bean.toString();

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=1059512&r1=1059511&r2=1059512&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 Sun Jan 16 08:26:08 2011
@@ -2194,25 +2194,6 @@ public abstract class ProcessorDefinitio
         addOutput(answer);
         return (Type) this;
     }
-    
-    /**
-     * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
-     * Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
-     *
-     * @param bean  the bean to invoke
-     * @param method  the method name to invoke on the bean (can be used to avoid ambiguty)
-     * @param parameterType the method parameter type to invoke on the bean (can be used to avoid ambiguty)
-     * @return the builder
-     */
-    @SuppressWarnings("unchecked")
-    public Type bean(Object bean, String method, Class parameterType) {
-        BeanDefinition answer = new BeanDefinition();
-        answer.setBean(bean);
-        answer.setMethod(method);
-        answer.setParameterType(parameterType);
-        addOutput(answer);
-        return (Type) this;
-    }
 
     /**
      * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
@@ -2245,25 +2226,6 @@ public abstract class ProcessorDefinitio
         addOutput(answer);
         return (Type) this;
     }
-    
-    /**
-     * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
-     * Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
-     *
-     * @param  beanType  the bean class, Camel will instantiate an object at runtime
-     * @param method  the method name to invoke on the bean (can be used to avoid ambiguty)
-     * @param parameterType the method parameter type to invoke on the bean (can be used to avoid ambiguty)
-     * @return the builder
-     */
-    @SuppressWarnings("unchecked")
-    public Type bean(Class beanType, String method, Class parameterType) {
-        BeanDefinition answer = new BeanDefinition();
-        answer.setBeanType(beanType);
-        answer.setMethod(method);
-        answer.setParameterType(parameterType);
-        addOutput(answer);
-        return (Type) this;
-    }
 
     /**
      * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
@@ -2293,22 +2255,6 @@ public abstract class ProcessorDefinitio
         addOutput(answer);
         return (Type) this;
     }
-    
-    /**
-     * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
-     * Adds a bean which is invoked which could be a final destination, or could be a transformation in a pipeline
-     *
-     * @param ref  reference to a bean to lookup in the registry
-     * @param method  the method name to invoke on the bean (can be used to avoid ambiguty)
-     * @param method  the method parameter type to invoke on the bean (can be used to avoid ambiguty)
-     * @return the builder
-     */
-    @SuppressWarnings("unchecked")
-    public Type beanRef(String ref, String method, Class parameterType) {
-        BeanDefinition answer = new BeanDefinition(ref, method, parameterType);
-        addOutput(answer);
-        return (Type) this;
-    }
 
     /**
      * <a href="http://camel.apache.org/message-translator.html">Message Translator EIP:</a>
@@ -2997,4 +2943,5 @@ public abstract class ProcessorDefinitio
     public String getLabel() {
         return "";
     }
-}
\ No newline at end of file
+
+}

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/MethodCallExpression.java Sun Jan 16 08:26:08 2011
@@ -16,9 +16,6 @@
  */
 package org.apache.camel.model.language;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -34,7 +31,6 @@ import org.apache.camel.component.bean.B
 import org.apache.camel.component.bean.MethodNotFoundException;
 import org.apache.camel.component.bean.RegistryBean;
 import org.apache.camel.language.bean.BeanExpression;
-import org.apache.camel.language.bean.RuntimeBeanExpressionException;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.OgnlHelper;
 
@@ -58,8 +54,6 @@ public class MethodCallExpression extend
     private Class<?> beanType;
     @XmlTransient
     private Object instance;
-    @XmlAttribute(required = false)
-    private Class parameterType;
 
     public MethodCallExpression() {
     }
@@ -69,28 +63,18 @@ public class MethodCallExpression extend
     }
 
     public MethodCallExpression(String beanName, String method) {
-        this(beanName, method, null);
-    }
-    
-    public MethodCallExpression(String beanName, String method, Class parameterType) {
         super(beanName);
         this.method = method;
-        this.parameterType = parameterType;
     }
     
     public MethodCallExpression(Object instance) {
         this(instance, null);
     }
-
-    public MethodCallExpression(Object instance, String method) {
-        this(instance, method, null);
-    }
     
-    public MethodCallExpression(Object instance, String method, Class parameterType) {
+    public MethodCallExpression(Object instance, String method) {
         super(instance.getClass().getName());
         this.instance = instance;
         this.method = method;
-        this.parameterType = parameterType;
     }
 
     public MethodCallExpression(Class<?> type) {
@@ -98,14 +82,9 @@ public class MethodCallExpression extend
     }
     
     public MethodCallExpression(Class<?> type, String method) {
-        this(type, method, null);
-    }
-    
-    public MethodCallExpression(Class<?> type, String method, Class parameterType) {
         super(type.toString());
         this.beanType = type;
         this.method = method;
-        this.parameterType = parameterType;
     }
 
     public String getLanguage() {
@@ -119,33 +98,25 @@ public class MethodCallExpression extend
     public void setMethod(String method) {
         this.method = method;
     }
-    
-    public Class getParameterType() {
-        return parameterType;
-    }
 
-    public void setParameterType(Class parameterType) {
-        this.parameterType = parameterType;
-    }
-    
     @Override
     public Expression createExpression(CamelContext camelContext) {
         Expression answer;
         if (beanType != null) {
             instance = ObjectHelper.newInstance(beanType);
-            answer = new BeanExpression(instance, getMethod(), parameterType);
+            answer = new BeanExpression(instance, getMethod());
         } else if (instance != null) {
-            answer = new BeanExpression(instance, getMethod(), parameterType);
+            answer = new BeanExpression(instance, getMethod());
         } else {
             String ref = beanName();
             // if its a ref then check that the ref exists
             BeanHolder holder = new RegistryBean(camelContext, ref);
             // get the bean which will check that it exists
             instance = holder.getBean();
-            answer = new BeanExpression(ref, getMethod(), parameterType);
+            answer = new BeanExpression(ref, getMethod());
         }
 
-        validateHasMethod(camelContext, instance, getMethod(), parameterType);
+        validateHasMethod(camelContext, instance, getMethod());
         return answer;
     }
 
@@ -164,8 +135,7 @@ public class MethodCallExpression extend
      * @param method   the method, can be <tt>null</tt> if no method name provided
      * @throws org.apache.camel.RuntimeCamelException is thrown if bean does not have the method
      */
-    @SuppressWarnings("rawtypes")
-    protected void validateHasMethod(CamelContext context, Object bean, String method, Class parameterType) {
+    protected void validateHasMethod(CamelContext context, Object bean, String method) {
         if (method == null) {
             return;
         }
@@ -182,13 +152,8 @@ public class MethodCallExpression extend
         }
 
         BeanInfo info = new BeanInfo(context, bean.getClass());
-        List<Class> parameterTypes = new ArrayList<Class>();
-        if (parameterType != null) {
-            parameterTypes.add(parameterType);
-        }
-
-        if (!info.hasMethod(method, parameterTypes)) {
-            throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method, parameterTypes));
+        if (!info.hasMethod(method)) {
+            throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
         }
     }
 
@@ -205,6 +170,6 @@ public class MethodCallExpression extend
 
     @Override
     public String toString() {
-        return "bean{" + beanName() + (method != null ? ", method=" + method : "") + (parameterType != null ? ", parameterTypes=" + parameterType : "") + "}";
+        return "bean{" + beanName() + (method != null ? ", method=" + method : "") + "}";
     }
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java Sun Jan 16 08:26:08 2011
@@ -17,7 +17,6 @@
 package org.apache.camel.component.bean;
 
 import java.io.ByteArrayInputStream;
-import java.io.StringReader;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
@@ -50,36 +49,16 @@ public class BeanExplicitMethodAmbiguous
         assertEquals("Bye Camel", out);
     }
     
-    public void testBeanImplicitMethodInvocationStringBody() throws Exception {
+    public void testBeanExplicitMethodInvocationStringBody() throws Exception {
         String out = template.requestBody("direct:foo", "Camel", String.class);
         assertEquals("String", out);
     }
     
-    public void testBeanImplicitMethodInvocationReaderBody() throws Exception {
-        String out = template.requestBody("direct:foo", new StringReader("Camel"), String.class);
-        assertEquals("Reader", out);
-    }
-    
-    public void testBeanImplicitMethodInvocationInputStreamBody() throws Exception {
+    public void testBeanExplicitMethodInvocationInputStreamBody() throws Exception {
         String out = template.requestBody("direct:foo", new ByteArrayInputStream("Camel".getBytes()), String.class);
         assertEquals("InputStream", out);
     }
-    
-    public void testBeanExplicitMethodInvocationString() throws Exception {
-        String out = template.requestBody("direct:explicitString", new ByteArrayInputStream("Camel".getBytes()), String.class);
-        assertEquals("String", out);
-    }
-    
-    public void testBeanExplicitMethodInvocationReader() throws Exception {
-        String out = template.requestBody("direct:explicitReader", new ByteArrayInputStream("Camel".getBytes()), String.class);
-        assertEquals("Reader", out);
-    }
 
-    public void testBeanExplicitMethodInvocationInputStream() throws Exception {
-        String out = template.requestBody("direct:explicitInputStream", "Camel", String.class);
-        assertEquals("InputStream", out);
-    }
-    
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
@@ -90,13 +69,7 @@ public class BeanExplicitMethodAmbiguous
                 from("direct:bye").beanRef("dummy");
                 
                 from("direct:foo").beanRef("dummy", "bar");
-                
-                from("direct:explicitString").to("bean:dummy?method=bar&parameterType=java.lang.String");
-                
-                from("direct:explicitReader").to("bean:dummy?method=bar&parameterType=java.io.Reader");
-                
-                from("direct:explicitInputStream").to("bean:dummy?method=bar&parameterType=java.io.InputStream");
             }
         };
     }
-}
\ No newline at end of file
+}

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java Sun Jan 16 08:26:08 2011
@@ -16,14 +16,10 @@
  */
 package org.apache.camel.component.bean;
 
-import java.io.InputStream;
-import java.io.Reader;
 import java.lang.reflect.Method;
-import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.TestCase;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.InOnly;
@@ -50,40 +46,6 @@ public class BeanInfoTest extends TestCa
         assertEquals("inOutMethod", operations.get(1).getMethod().getName());
         assertEquals("robustInOnlyMethod", operations.get(2).getMethod().getName());
     }
-    
-    @SuppressWarnings("rawtypes")
-    public void testHasMethodWithParameterTypes() throws Exception {
-        BeanInfo info = createBeanInfo(MyDummyBean.class);
-
-        assertTrue(info.hasMethod("test", null));
-        
-        List<Class> parameterTypes = new ArrayList<Class>();
-        assertTrue(info.hasMethod("test", parameterTypes));
-        
-        parameterTypes.clear();
-        parameterTypes.add(String.class);
-        assertTrue(info.hasMethod("hello", parameterTypes));
-        
-        // method with two Strings
-        parameterTypes.add(String.class);
-        assertTrue(info.hasMethod("hello", parameterTypes));
-        
-        parameterTypes.clear();
-        parameterTypes.add(String.class);
-        assertTrue(info.hasMethod("bar", parameterTypes));
-        
-        parameterTypes.clear();
-        parameterTypes.add(Reader.class);
-        assertTrue(info.hasMethod("bar", parameterTypes));
-        
-        parameterTypes.clear();
-        parameterTypes.add(InputStream.class);
-        assertTrue(info.hasMethod("bar", parameterTypes));
-        
-        parameterTypes.clear();
-        parameterTypes.add(Long.class);
-        assertFalse(info.hasMethod("bar", parameterTypes));
-    }
 
     public void testMethodPatternUsingMethodAnnotations() throws Exception {
         BeanInfo info = createBeanInfo(Foo.class);

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyDummyBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyDummyBean.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyDummyBean.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyDummyBean.java Sun Jan 16 08:26:08 2011
@@ -38,7 +38,7 @@ public class MyDummyBean {
     public String bye(String s) {
         return "Bye " + s;
     }
-
+    
     public String bar(String s) {
         return "String";
     }
@@ -50,25 +50,4 @@ public class MyDummyBean {
     public String bar(InputStream s) {
         return "InputStream";
     }
-
-    public boolean shouldProcess(String s) {
-        return true;
-    }
-    
-    public boolean shouldProcess(Reader r) {
-        return false;
-    }
-    
-    public boolean shouldProcess(InputStream i) {
-        return false;
-    }
-    
-    public String test() {
-        return "test";
-    }
-
-    @Override
-    public String toString() {
-        return this.getClass().getName();
-    }
-}
\ No newline at end of file
+}

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java?rev=1059512&r1=1059511&r2=1059512&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java Sun Jan 16 08:26:08 2011
@@ -708,8 +708,7 @@ public class SimpleTest extends Language
             assertExpression("${in.body.getFriend.getFriend.getName}", "");
             fail("Should have thrown exception");
         } catch (RuntimeBeanExpressionException e) {
-            assertEquals("Failed to invoke method: .getFriend.getFriend.getName with "
-                    + "parameter type: null on null due to: java.lang.NullPointerException", e.getMessage());
+            assertEquals("Failed to invoke method: .getFriend.getFriend.getName on null due to: java.lang.NullPointerException", e.getMessage());
             assertIsInstanceOf(NullPointerException.class, e.getCause());
         }
     }
@@ -735,8 +734,7 @@ public class SimpleTest extends Language
             assertExpression("${in.body.friend.friend.name}", "");
             fail("Should have thrown exception");
         } catch (RuntimeBeanExpressionException e) {
-            assertEquals("Failed to invoke method: .friend.friend.name with "
-                    + "parameter type: null on null due to: java.lang.NullPointerException", e.getMessage());
+            assertEquals("Failed to invoke method: .friend.friend.name on null due to: java.lang.NullPointerException", e.getMessage());
             assertIsInstanceOf(NullPointerException.class, e.getCause());
         }
     }

Added: camel/trunk/diff_1056749_1056745.txt
URL: http://svn.apache.org/viewvc/camel/trunk/diff_1056749_1056745.txt?rev=1059512&view=auto
==============================================================================
--- camel/trunk/diff_1056749_1056745.txt (added)
+++ camel/trunk/diff_1056749_1056745.txt Sun Jan 16 08:26:08 2011
@@ -0,0 +1,320 @@
+Index: camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java
+===================================================================
+--- camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java	(revision 1056749)
++++ camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodAmbiguousTest.java	(revision 1056745)
+@@ -17,7 +17,6 @@
+ package org.apache.camel.component.bean;
+ 
+ import java.io.ByteArrayInputStream;
+-import java.io.StringReader;
+ 
+ import org.apache.camel.ContextTestSupport;
+ import org.apache.camel.builder.RouteBuilder;
+@@ -50,36 +49,16 @@
+         assertEquals("Bye Camel", out);
+     }
+     
+-    public void testBeanImplicitMethodInvocationStringBody() throws Exception {
++    public void testBeanExplicitMethodInvocationStringBody() throws Exception {
+         String out = template.requestBody("direct:foo", "Camel", String.class);
+         assertEquals("String", out);
+     }
+     
+-    public void testBeanImplicitMethodInvocationReaderBody() throws Exception {
+-        String out = template.requestBody("direct:foo", new StringReader("Camel"), String.class);
+-        assertEquals("Reader", out);
+-    }
+-    
+-    public void testBeanImplicitMethodInvocationInputStreamBody() throws Exception {
++    public void testBeanExplicitMethodInvocationInputStreamBody() throws Exception {
+         String out = template.requestBody("direct:foo", new ByteArrayInputStream("Camel".getBytes()), String.class);
+         assertEquals("InputStream", out);
+     }
+-    
+-    public void testBeanExplicitMethodInvocationString() throws Exception {
+-        String out = template.requestBody("direct:explicitString", new ByteArrayInputStream("Camel".getBytes()), String.class);
+-        assertEquals("String", out);
+-    }
+-    
+-    public void testBeanExplicitMethodInvocationReader() throws Exception {
+-        String out = template.requestBody("direct:explicitReader", new ByteArrayInputStream("Camel".getBytes()), String.class);
+-        assertEquals("Reader", out);
+-    }
+ 
+-    public void testBeanExplicitMethodInvocationInputStream() throws Exception {
+-        String out = template.requestBody("direct:explicitInputStream", "Camel", String.class);
+-        assertEquals("InputStream", out);
+-    }
+-    
+     @Override
+     protected RouteBuilder createRouteBuilder() throws Exception {
+         return new RouteBuilder() {
+@@ -90,12 +69,6 @@
+                 from("direct:bye").beanRef("dummy");
+                 
+                 from("direct:foo").beanRef("dummy", "bar");
+-                
+-                from("direct:explicitString").to("bean:dummy?method=bar&type=java.lang.String");
+-                
+-                from("direct:explicitReader").to("bean:dummy?method=bar&type=java.io.Reader");
+-                
+-                from("direct:explicitInputStream").to("bean:dummy?method=bar&type=java.io.InputStream");
+             }
+         };
+     }
+Index: camel-core/src/test/java/org/apache/camel/converter/ObjectConverterTest.java
+===================================================================
+--- camel-core/src/test/java/org/apache/camel/converter/ObjectConverterTest.java	(revision 1056749)
++++ camel-core/src/test/java/org/apache/camel/converter/ObjectConverterTest.java	(revision 1056745)
+@@ -47,13 +47,6 @@
+         assertEquals(Byte.valueOf("4"), ObjectConverter.toByte("4"));
+         assertEquals(null, ObjectConverter.toByte(new Date()));
+     }
+-    
+-    public void testToClass() {
+-        assertEquals(String.class, ObjectConverter.toClass(String.class));
+-        assertEquals(String.class, ObjectConverter.toClass("java.lang.String"));
+-        assertEquals(null, ObjectConverter.toClass(new Integer(4)));
+-        assertEquals(null, ObjectConverter.toClass("foo.Bar"));
+-    }
+ 
+     public void testToShort() {
+         assertEquals(Short.valueOf("4"), ObjectConverter.toShort(Short.valueOf("4")));
+Index: camel-core/src/main/java/org/apache/camel/Exchange.java
+===================================================================
+--- camel-core/src/main/java/org/apache/camel/Exchange.java	(revision 1056749)
++++ camel-core/src/main/java/org/apache/camel/Exchange.java	(revision 1056745)
+@@ -84,7 +84,6 @@
+     String BATCH_COMPLETE             = "CamelBatchComplete";
+     String BEAN_METHOD_NAME           = "CamelBeanMethodName";
+     String BEAN_MULTI_PARAMETER_ARRAY = "CamelBeanMultiParameterArray";
+-    String BEAN_TYPE_NAME             = "CamelBeanTypeName";
+     String BINDING                    = "CamelBinding";
+ 
+     String CHARSET_NAME      = "CamelCharsetName";
+Index: camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java
+===================================================================
+--- camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java	(revision 1056749)
++++ camel-core/src/main/java/org/apache/camel/converter/ObjectConverter.java	(revision 1056745)
+@@ -65,7 +65,6 @@
+     /**
+      * Creates an iterator over the value
+      */
+-    @SuppressWarnings("rawtypes")
+     @Converter
+     public static Iterator iterator(Object value) {
+         return ObjectHelper.createIterator(value);
+@@ -107,21 +106,6 @@
+     public static String fromCharArray(char[] value) {
+         return new String(value);
+     }
+-    
+-    /**
+-     * Returns the converted value, or null if the value is null
+-     */
+-    @SuppressWarnings("rawtypes")
+-    @Converter
+-    public static Class toClass(Object value) {
+-        if (value instanceof Class) {
+-            return (Class) value;
+-        } else if (value instanceof String) {
+-            return ObjectHelper.loadClass((String) value);
+-        } else {
+-            return null;
+-        }
+-    }
+ 
+     /**
+      * Returns the converted value, or null if the value is null
+Index: camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java
+===================================================================
+--- camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java	(revision 1056749)
++++ camel-core/src/main/java/org/apache/camel/component/bean/BeanProcessor.java	(revision 1056745)
+@@ -47,8 +47,6 @@
+     private String method;
+     private BeanHolder beanHolder;
+     private boolean shorthandMethod;
+-    @SuppressWarnings("rawtypes")
+-    private Class type;
+ 
+     public BeanProcessor(Object pojo, BeanInfo beanInfo) {
+         this(new ConstantBeanHolder(pojo, beanInfo));
+@@ -76,13 +74,9 @@
+         AsyncProcessorHelper.process(this, exchange);
+     }
+ 
+-    @SuppressWarnings({ "unused", "rawtypes" })
+     public boolean process(Exchange exchange, AsyncCallback callback) {
+         // do we have an explicit method name we always should invoke
+         boolean isExplicitMethod = ObjectHelper.isNotEmpty(method);
+-        // do we have an explicit parameter type we should invoke if we have multiple possible
+-        // methods
+-        boolean isExplicitType = ObjectHelper.isNotEmpty(type);
+ 
+         Object bean = beanHolder.getBean();
+         BeanInfo beanInfo = beanHolder.getBeanInfo();
+@@ -104,7 +98,7 @@
+         }
+ 
+         Message in = exchange.getIn();
+-        
++
+         // Now it gets a bit complicated as ProxyHelper can proxy beans which we later
+         // intend to invoke (for example to proxy and invoke using spring remoting).
+         // and therefore the message body contains a BeanInvocation object.
+@@ -128,14 +122,13 @@
+                 return true;
+             }
+         }
+-        
++
+         // set temporary header which is a hint for the bean info that introspect the bean
+         if (in.getHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY) == null) {
+             in.setHeader(Exchange.BEAN_MULTI_PARAMETER_ARRAY, isMultiParameterArray());
+         }
+ 
+         String prevMethod = null;
+-        Class prevType = null;
+         MethodInvocation invocation;
+         if (methodObject != null) {
+             invocation = beanInfo.createInvocation(methodObject, bean, exchange);
+@@ -145,10 +138,6 @@
+                 prevMethod = in.getHeader(Exchange.BEAN_METHOD_NAME, String.class);
+                 in.setHeader(Exchange.BEAN_METHOD_NAME, method);
+             }
+-            if (isExplicitType) {
+-                prevType = in.getHeader(Exchange.BEAN_TYPE_NAME, Class.class);
+-                in.setHeader(Exchange.BEAN_TYPE_NAME, type);
+-            }
+             try {
+                 invocation = beanInfo.createInvocation(bean, exchange);
+             } catch (Throwable e) {
+@@ -269,22 +258,7 @@
+     public void setShorthandMethod(boolean shorthandMethod) {
+         this.shorthandMethod = shorthandMethod;
+     }
+-    
+-    @SuppressWarnings("rawtypes")
+-    public Class getType() {
+-        return type;
+-    }
+ 
+-    /**
+-     * Sets the type/class name to which the body should converted before the suitable method is
+-     * determined.
+-     * @param type
+-     */
+-    @SuppressWarnings("rawtypes")
+-    public void setType(Class type) {
+-        this.type = type;
+-    }
+-
+     // Implementation methods
+     //-------------------------------------------------------------------------
+     protected void doStart() throws Exception {
+Index: camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+===================================================================
+--- camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java	(revision 1056749)
++++ camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java	(revision 1056745)
+@@ -129,12 +129,10 @@
+         return null;
+     }
+ 
+-    @SuppressWarnings("rawtypes")
+     public MethodInvocation createInvocation(Object pojo, Exchange exchange) throws AmbiguousMethodCallException, MethodNotFoundException {
+         MethodInfo methodInfo = null;
+ 
+         String name = exchange.getIn().getHeader(Exchange.BEAN_METHOD_NAME, String.class);
+-        Class type = exchange.getIn().getHeader(Exchange.BEAN_TYPE_NAME, Class.class);
+         if (name != null) {
+             if (hasMethod(name)) {
+                 List<MethodInfo> methods = getOperations(name);
+@@ -145,7 +143,7 @@
+                     // there are more methods with that name so we cannot decide which to use
+ 
+                     // but first lets try to choose a method and see if that comply with the name
+-                    methodInfo = chooseMethod(pojo, exchange, name, type);
++                    methodInfo = chooseMethod(pojo, exchange, name);
+                     if (methodInfo == null || !name.equals(methodInfo.getMethod().getName())) {
+                         throw new AmbiguousMethodCallException(exchange, methods);
+                     }
+@@ -156,7 +154,7 @@
+             }
+         }
+         if (methodInfo == null) {
+-            methodInfo = chooseMethod(pojo, exchange, name, null);
++            methodInfo = chooseMethod(pojo, exchange, name);
+         }
+         if (methodInfo == null) {
+             methodInfo = defaultMethod;
+@@ -282,7 +280,7 @@
+         return answer;
+     }
+ 
+-    @SuppressWarnings({ "unchecked", "rawtypes" })
++    @SuppressWarnings("unchecked")
+     protected MethodInfo createMethodInfo(Class clazz, Method method) {
+         Class[] parameterTypes = method.getParameterTypes();
+         Annotation[][] parametersAnnotations = method.getParameterAnnotations();
+@@ -351,17 +349,15 @@
+      * @param pojo the bean to invoke a method on
+      * @param exchange the message exchange
+      * @param name an optional name of the method that must match, use <tt>null</tt> to indicate all methods
+-     * @param type an optional type of the method parameter that must match, use <tt>null</tt> to indicate all types
+      * @return the method to invoke or null if no definitive method could be matched
+      * @throws AmbiguousMethodCallException is thrown if cannot chose method due to ambiguous
+      */
+-    @SuppressWarnings("rawtypes")
+-    protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String name, Class type) throws AmbiguousMethodCallException {
++    protected MethodInfo chooseMethod(Object pojo, Exchange exchange, String name) throws AmbiguousMethodCallException {
+         // @Handler should be select first
+         // then any single method that has a custom @annotation
+         // or any single method that has a match parameter type that matches the Exchange payload
+         // and last then try to select the best among the rest
+-        
++
+         if (name != null) {
+             // filter all lists to only include methods with this name
+             removeNonMatchingMethods(operationsWithHandlerAnnotation, name);
+@@ -373,13 +369,6 @@
+             removeAllSetterOrGetterMethods(operationsWithCustomAnnotation);
+             removeAllSetterOrGetterMethods(operationsWithBody);
+         }
+-        
+-        if (type != null) {
+-            // filter all lists to only include methods with this argument type
+-            removeNonMatchingMethods(operationsWithHandlerAnnotation, type);
+-            removeNonMatchingMethods(operationsWithCustomAnnotation, type);
+-            removeNonMatchingMethods(operationsWithBody, type);
+-        }
+ 
+         if (operationsWithHandlerAnnotation.size() > 1) {
+             // if we have more than 1 @Handler then its ambiguous
+@@ -415,7 +404,6 @@
+         return null;
+     }
+     
+-    @SuppressWarnings("rawtypes")
+     private MethodInfo chooseMethodWithMatchingBody(Exchange exchange, Collection<MethodInfo> operationList)
+         throws AmbiguousMethodCallException {
+         // lets see if we can find a method who's body param type matches the message body
+@@ -677,19 +665,6 @@
+             }
+         }
+     }
+-    
+-    @SuppressWarnings("rawtypes")
+-    private static void removeNonMatchingMethods(List<MethodInfo> methods, Class type) {
+-        Iterator<MethodInfo> it = methods.iterator();
+-        while (it.hasNext()) {
+-            MethodInfo info = it.next();
+-            Class<?>[] parameterTypes = info.getMethod().getParameterTypes();
+-            if (!(parameterTypes.length > 0 && parameterTypes[0].isAssignableFrom(type))) {
+-                // type does not match so remove it
+-                it.remove();
+-            }
+-        }
+-    }
+ 
+     private static Class<?> getTargetClass(Class<?> clazz) {
+         if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) {

Propchange: camel/trunk/diff_1056749_1056745.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain