Thanks for that patch. I was a bit confused, when you suggested to access MethodsRegistry statically in JIRA. Now that seems to be a nice solution.

I'm currently working on populate() and there are a few things worth discussing. I hope that I have the time to write something down this evening.

Have a nice sunday!
Benedikt

Am 05.02.2012 00:58, schrieb simonetrip...@apache.org:
Author: simonetripodi
Date: Sat Feb  4 23:58:13 2012
New Revision: 1240646

URL: http://svn.apache.org/viewvc?rev=1240646&view=rev
Log:
this class is a singleton, methods registry is a singleton, no needs to have 
the methods registry as a class member

Modified:
     
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java

Modified: 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java?rev=1240646&r1=1240645&r2=1240646&view=diff
==============================================================================
--- 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java
 (original)
+++ 
commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/PropertyDescriptorsRegistry.java
 Sat Feb  4 23:58:13 2012
@@ -40,8 +40,6 @@ import java.util.concurrent.locks.Reentr
  final class PropertyDescriptorsRegistry
  {

-    private static final AccessibleObjectsRegistry<Method>  METHODS_REGISTRY = 
AccessibleObjectsRegistry.getMethodsRegistry();
-
      private static final PropertyDescriptorsRegistry INSTANCE = new 
PropertyDescriptorsRegistry();

      public static PropertyDescriptorsRegistry getInstance()
@@ -49,6 +47,8 @@ final class PropertyDescriptorsRegistry
          return INSTANCE;
      }

+    private final AccessibleObjectsRegistry<Method>  methodsRegistry = 
AccessibleObjectsRegistry.getMethodsRegistry();
+
      private final ReadWriteLock lock = new ReentrantReadWriteLock();

      private final Map<Class<?>, WeakReference<Map<String, 
PropertyDescriptor>>>  cache =
@@ -103,7 +103,7 @@ final class PropertyDescriptorsRegistry
          }
      }

-    private static void makeMethodsAccessible( Class<?>  beanType, 
PropertyDescriptor propertyDescriptor )
+    private void makeMethodsAccessible( Class<?>  beanType, PropertyDescriptor 
propertyDescriptor )
          throws IntrospectionException
      {
          // we need to make sure that methods are accessible for anonymous 
types
@@ -111,13 +111,13 @@ final class PropertyDescriptorsRegistry
          if ( propertyDescriptor.getReadMethod() != null )
          {
              Method readMethod = propertyDescriptor.getReadMethod();
-            readMethod = METHODS_REGISTRY.get( true, beanType, 
readMethod.getName() );
+            readMethod = methodsRegistry.get( true, beanType, 
readMethod.getName() );
              propertyDescriptor.setReadMethod( readMethod );
          }
          if ( propertyDescriptor.getWriteMethod() != null )
          {
              Method writeMethod = propertyDescriptor.getWriteMethod();
-            writeMethod = METHODS_REGISTRY.get( true, beanType, 
writeMethod.getName(), writeMethod.getParameterTypes() );
+            writeMethod = methodsRegistry.get( true, beanType, 
writeMethod.getName(), writeMethod.getParameterTypes() );
              propertyDescriptor.setWriteMethod( writeMethod );
          }
      }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to