commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1348213 - in /commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2: BeanProperties.java DefaultBeanProperties.java
Date Fri, 08 Jun 2012 19:59:19 GMT
Author: simonetripodi
Date: Fri Jun  8 19:59:18 2012
New Revision: 1348213

URL: http://svn.apache.org/viewvc?rev=1348213&view=rev
Log:
added a method to check a property is present in a bean type

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

Modified: commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java?rev=1348213&r1=1348212&r2=1348213&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/BeanProperties.java
Fri Jun  8 19:59:18 2012
@@ -29,6 +29,17 @@ public interface BeanProperties<B>
 {
 
     /**
+     * Checks if the current bean type has a property identified by the input name.
+     *
+     * @param propertyName the name of the property to be checked.
+     * @return true if the current bean type has a property identified by the input name,
+     *         false otherwise.
+     * @throws IntrospectionException
+     */
+    boolean hasProperty( String propertyName )
+        throws IntrospectionException;
+
+    /**
      * Checks if the specified property name identifies a readable property.
      *
      * @param propertyName the name of the property to be checked.

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=1348213&r1=1348212&r2=1348213&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
Fri Jun  8 19:59:18 2012
@@ -42,6 +42,19 @@ final class DefaultBeanProperties<B>
 
     // checks
 
+    public boolean hasProperty( String propertyName )
+        throws IntrospectionException
+    {
+        checkNotNull( propertyName, "Parameter 'propertyName' must not be null!" );
+        PropertyDescriptor propertyDescriptor = registry.getPropertyDescriptor( beanClass,
propertyName );
+
+        if ( propertyDescriptor == null )
+        {
+            return false;
+        }
+        return true;
+    }
+
     /**
      * {@inheritDoc}
      */



Mime
View raw message