commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1442698 - in /commons/sandbox/beanutils2/trunk/src: main/java/org/apache/commons/beanutils2/ test/java/org/apache/commons/beanutils2/
Date Tue, 05 Feb 2013 19:03:37 GMT
Author: britter
Date: Tue Feb  5 19:03:37 2013
New Revision: 1442698

URL: http://svn.apache.org/viewvc?rev=1442698&view=rev
Log:
Add missing handling of mapped properties to BeanProperties

Modified:
    commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java

Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java?rev=1442698&r1=1442697&r2=1442698&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/DefaultBeanProperties.java
Tue Feb  5 19:03:37 2013
@@ -69,8 +69,12 @@ final class DefaultBeanProperties<B>
             IndexedPropertyDescriptor indexed = (IndexedPropertyDescriptor) propertyDescriptor;
             return indexed.getIndexedReadMethod() != null ? true : false;
         }
+        if ( propertyDescriptor instanceof MappedPropertyDescriptor )
+        {
+            MappedPropertyDescriptor mapped = (MappedPropertyDescriptor) propertyDescriptor;
+            return mapped.getMappedReadMethod() != null ? true : false;
+        }
 
-        // TODO what about mapped properties?
         return propertyDescriptor.getReadMethod() != null ? true : false;
     }
 
@@ -88,8 +92,12 @@ final class DefaultBeanProperties<B>
             IndexedPropertyDescriptor indexed = (IndexedPropertyDescriptor) propertyDescriptor;
             return indexed.getIndexedWriteMethod() != null ? true : false;
         }
+        if ( propertyDescriptor instanceof MappedPropertyDescriptor )
+        {
+            MappedPropertyDescriptor mapped = (MappedPropertyDescriptor) propertyDescriptor;
+            return mapped.getMappedWriteMethod() != null ? true : false;
+        }
 
-        // TODO what about mapped properties?
         return propertyDescriptor.getWriteMethod() != null ? true : false;
     }
 

Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java?rev=1442698&r1=1442697&r2=1442698&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsReadableTestCase.java
Tue Feb  5 19:03:37 2013
@@ -68,6 +68,14 @@ public class IsReadableTestCase
     }
 
     @Test
+    public void isReadableMappedIntProperty()
+        throws Exception
+    {
+        assertTrue( "isReadable returned false for a read/write mapped property!",
+                    on( TestBean.class ).getProperties().isReadable( "mappedIntProperty"
) );
+    }
+
+    @Test
     public void isReadbleMapProperty()
         throws Exception
     {

Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java?rev=1442698&r1=1442697&r2=1442698&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/IsWritableTestCase.java
Tue Feb  5 19:03:37 2013
@@ -68,6 +68,14 @@ public class IsWritableTestCase
     }
 
     @Test
+    public void isWritableMappedIntProperty()
+        throws Exception
+    {
+        assertTrue( "isWritable returned false for a read/write mapped property!",
+                    on( TestBean.class ).getProperties().isWritable( "mappedIntProperty"
) );
+    }
+
+    @Test
     public void isWritbleMapProperty()
         throws Exception
     {



Mime
View raw message