You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2009/07/10 14:40:42 UTC

svn commit: r792924 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java

Author: gnodet
Date: Fri Jul 10 12:40:41 2009
New Revision: 792924

URL: http://svn.apache.org/viewvc?rev=792924&view=rev
Log:
Try to remove a MLK

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java?rev=792924&r1=792923&r2=792924&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/ReflectionUtils.java Fri Jul 10 12:40:41 2009
@@ -22,6 +22,8 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -36,7 +38,7 @@
  * @version $Rev$, $Date$
  */
 public class ReflectionUtils {
-           
+
     private static Map<Class, PropertyDescriptor[]> beanInfos = Collections.synchronizedMap(new WeakHashMap<Class, PropertyDescriptor[]>());
 
     public static Set<String> getImplementedInterfaces(Set<String> classes, Class clazz) {
@@ -153,6 +155,7 @@
             props.clear();
             for (int i = 0; i < pds.length - 1; i++) {
                 if (pds[i] != null) {
+                    pds[i].type = null;
                     props.add(pds[i]);
                 }
             }
@@ -178,30 +181,26 @@
     public static class PropertyDescriptor {
         private String name;
         private Class type;
-        private Method getter;
-        private Method setter;
+        private SoftReference<Method> getter;
+        private SoftReference<Method> setter;
 
         public PropertyDescriptor(String name, Class type, Method getter, Method setter) {
             this.name = name;
             this.type = type;
-            this.getter = getter;
-            this.setter = setter;
+            this.getter = new SoftReference<Method>(getter);
+            this.setter = new SoftReference<Method>(setter);
         }
 
         public String getName() {
             return name;
         }
 
-        public Type getType() {
-            return type;
-        }
-
         public Method getGetter() {
-            return getter;
+            return getter.get();
         }
 
         public Method getSetter() {
-            return setter;
+            return setter.get();
         }
     }