camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r736231 - in /camel/branches/camel-1.x: ./ camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Date Wed, 21 Jan 2009 05:51:29 GMT
Author: ningjiang
Date: Tue Jan 20 21:51:29 2009
New Revision: 736231

URL: http://svn.apache.org/viewvc?rev=736231&view=rev
Log:
Merged revisions 736227 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r736227 | ningjiang | 2009-01-21 13:48:16 +0800 (Wed, 21 Jan 2009) | 1 line
  
  CAMEL-1279 take the setter which's parameterType is Object to be last candidate
........

Modified:
    camel/branches/camel-1.x/   (props changed)
    camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java

Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 20 21:51:29 2009
@@ -1,2 +1,2 @@
 /activemq/camel/trunk:732943,733749,734053,734057-734058,734064,734130,734309,734340-734342,734348,734392,734422,734727,734903,734932,735421,735427,735732
-/camel/trunk:735847,735888
+/camel/trunk:735847,735888,736227

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

Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=736231&r1=736230&r2=736231&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
(original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
Tue Jan 20 21:51:29 2009
@@ -270,16 +270,24 @@
         // Build the method name.
         name = "set" + ObjectHelper.capitalize(name);
         while (clazz != Object.class) {
+            // Since Object.class.isInstance all the objects,
+            // Here we just make sure it will be add to the bottom of the set.
+            Method objectSetMethod = null;
             Method[] methods = clazz.getMethods();
             for (Method method : methods) {
                 Class params[] = method.getParameterTypes();
                 if (method.getName().equals(name) && params.length == 1) {
                     Class paramType = params[0];
-                    if (typeConverter != null || isSettableType(paramType) || paramType.isInstance(value))
{
+                    if (paramType.equals(Object.class)) {                        
+                        objectSetMethod = method;
+                    } else if (typeConverter != null || isSettableType(paramType) || paramType.isInstance(value))
{
                         candidates.add(method);
                     }
                 }
             }
+            if (objectSetMethod != null) {
+                candidates.add(objectSetMethod);
+            }
             clazz = clazz.getSuperclass();
         }
 
@@ -293,8 +301,8 @@
             if (LOG.isTraceEnabled()) {
                 LOG.trace("Found " + candidates.size() + " suitable setter methods for setting
" + name);
             }
-            // perfer to use the one with the same instance if any exists
-            for (Method method : candidates) {
+            // prefer to use the one with the same instance if any exists
+            for (Method method : candidates) {                               
                 if (method.getParameterTypes()[0].isInstance(value)) {
                     if (LOG.isTraceEnabled()) {
                         LOG.trace("Method " + method + " is the best candidate as it has
parameter with same instance type");



Mime
View raw message