Author: davsclaus
Date: Sun Apr 14 09:42:29 2013
New Revision: 1467753
URL: http://svn.apache.org/r1467753
Log:
CAMEL-6272: Bean - Improve choose method logic for no parameter methods
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
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=1467753&r1=1467752&r2=1467753&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 Apr 14 09:42:29 2013
@@ -500,7 +500,7 @@ public class BeanInfo {
if (noParameters && localOperationsWithNoBody.size() == 1) {
// if there was a method name configured and it has no parameters,
then use the method with no body (eg no parameters)
return localOperationsWithNoBody.get(0);
- } else if (localOperationsWithBody.size() == 1) {
+ } else if (!noParameters && localOperationsWithBody.size() == 1) {
// if there is one method with body then use that one
return localOperationsWithBody.get(0);
}
@@ -874,9 +874,15 @@ public class BeanInfo {
return false;
}
+ // is it a method with no parameters
+ boolean noParameters = methodName.endsWith("()");
+ if (noParameters) {
+ return method.getParameterTypes().length == 0;
+ }
+
// match qualifier types which is used to select among overloaded
methods
String types = ObjectHelper.between(methodName, "(", ")");
- if (types != null) {
+ if (ObjectHelper.isNotEmpty(types)) {
// we must qualify based on types to match method
String[] parameters = StringQuoteHelper.splitSafeQuote(types, ',');
Iterator<?> it = ObjectHelper.createIterator(parameters);