Author: davsclaus
Date: Mon Jun  7 11:38:52 2010
New Revision: 952190

URL: http://svn.apache.org/viewvc?rev=952190&view=rev
Log:
CAMEL-2642: Fixed inconsistence in IntrospectionSupport for getProperty and 
getProperties.

Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.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=952190&r1=952189&r2=952190&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
 Mon Jun  7 11:38:52 2010
@@ -73,6 +73,13 @@ public class BeanInfo {
     private MethodInfo defaultMethod;
     private BeanInfo superBeanInfo;
 
+    static {
+        // exclude all java.lang.Object methods as we dont want to invoke them
+        EXCLUDED_METHODS.addAll(Arrays.asList(Object.class.getMethods()));
+        // exclude all java.lang.reflect.Proxy methods as we dont want to 
invoke them
+        EXCLUDED_METHODS.addAll(Arrays.asList(Proxy.class.getMethods()));
+    }
+
     public BeanInfo(CamelContext camelContext, Class<?> type) {
         this(camelContext, type, createParameterMappingStrategy(camelContext));
     }
@@ -82,16 +89,6 @@ public class BeanInfo {
         this.type = type;
         this.strategy = strategy;
 
-        // configure the default excludes methods
-        synchronized (EXCLUDED_METHODS) {
-            if (EXCLUDED_METHODS.size() == 0) {
-                // exclude all java.lang.Object methods as we dont want to 
invoke them
-                
EXCLUDED_METHODS.addAll(Arrays.asList(Object.class.getMethods()));
-                // exclude all java.lang.reflect.Proxy methods as we dont want 
to invoke them
-                
EXCLUDED_METHODS.addAll(Arrays.asList(Proxy.class.getMethods()));
-            }
-        }
-
         introspect(getType());
         // if there are only 1 method with 1 operation then select it as a 
default/fallback method
         if (operations.size() == 1) {

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java?rev=952190&r1=952189&r2=952190&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
 Mon Jun  7 11:38:52 2010
@@ -368,20 +368,6 @@ public final class IntrospectionSupport 
         return null;
     }
 
-    @Deprecated
-    private static String convertToString(Object value, Class<?> type) throws 
URISyntaxException {
-        PropertyEditor editor = PropertyEditorManager.findEditor(type);
-        if (editor != null) {
-            editor.setValue(value);
-            return editor.getAsText();
-        }
-        if (type == URI.class) {
-            return value.toString();
-        }
-        return null;
-    }
-
-    @Deprecated
     private static Set<Method> findSetterMethods(TypeConverter typeConverter, 
Class<?> clazz, String name, Object value) {
         Set<Method> candidates = new LinkedHashSet<Method>();
 
@@ -398,7 +384,7 @@ public final class IntrospectionSupport 
                     Class<?> paramType = params[0];
                     if (paramType.equals(Object.class)) {                      
  
                         objectSetMethod = method;
-                    } else if (typeConverter != null || 
isSettableType(paramType) || paramType.isInstance(value)) {
+                    } else if (typeConverter != null || isSetter(method) || 
paramType.isInstance(value)) {
                         candidates.add(method);
                     }
                 }
@@ -436,18 +422,4 @@ public final class IntrospectionSupport 
         }
     }
 
-    @Deprecated
-    private static boolean isSettableType(Class<?> clazz) {
-        // TODO: Why limit to what the JDK property editor can set?
-        if (PropertyEditorManager.findEditor(clazz) != null) {
-            return true;
-        }
-        if (clazz == URI.class) {
-            return true;
-        }
-        if (clazz == Boolean.class) {
-            return true;
-        }
-        return false;
-    }
 }


Reply via email to