Author: davsclaus
Date: Sun Apr 14 09:44:39 2013
New Revision: 1467755
URL: http://svn.apache.org/r1467755
Log:
CAMEL-6272: Bean - Improve choose method logic for no parameter methods
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1467753
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL:
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?rev=1467755&r1=1467754&r2=1467755&view=diff
==============================================================================
---
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
(original)
+++
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
Sun Apr 14 09:44:39 2013
@@ -481,7 +481,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);
}
@@ -790,9 +790,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);