commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils PropertyUtils.java
Date Sun, 24 Mar 2002 09:56:05 GMT
dion        02/03/24 01:56:05

  Modified:    beanutils/src/java/org/apache/commons/beanutils
                        PropertyUtils.java
  Log:
  Fixed bug 7309
  
  Revision  Changes    Path
  1.23      +30 -4     jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java
  
  Index: PropertyUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- PropertyUtils.java	16 Mar 2002 04:11:04 -0000	1.22
  +++ PropertyUtils.java	24 Mar 2002 09:56:05 -0000	1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
1.22 2002/03/16 04:11:04 craigmcc Exp $
  - * $Revision: 1.22 $
  - * $Date: 2002/03/16 04:11:04 $
  + * $Header: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,v
1.23 2002/03/24 09:56:05 dion Exp $
  + * $Revision: 1.23 $
  + * $Date: 2002/03/24 09:56:05 $
    *
    * ====================================================================
    *
  @@ -131,7 +131,7 @@
    * @author Gregor Rażman
    * @author Jan Sorensen
    * @author Scott Sanders
  - * @version $Revision: 1.22 $ $Date: 2002/03/16 04:11:04 $
  + * @version $Revision: 1.23 $ $Date: 2002/03/24 09:56:05 $
    */
   
   public class PropertyUtils {
  @@ -582,6 +582,19 @@
                   throw new NoSuchMethodException("Property '" + name +
                           "' has no mapped getter method");
               }
  +        } else {
  +          /* means that the result has to be retrieved from a map */
  +          Method readMethod = descriptor.getReadMethod();
  +          if (readMethod != null) {
  +            Object invokeResult = readMethod.invoke(bean, new Object[0]);
  +            /* test and fetch from the map */
  +            if (invokeResult instanceof java.util.Map) {
  +              result = ((java.util.Map)invokeResult).get(key);
  +            }
  +          } else {
  +            throw new NoSuchMethodException("Property '" + name +
  +                    "' has no mapped getter method");
  +          }
           }
           return result;
   
  @@ -1389,6 +1402,19 @@
                           ("Property '" + name +
                           "' has no mapped setter method");
               }
  +        } else {
  +          /* means that the result has to be retrieved from a map */
  +          Method readMethod = descriptor.getReadMethod();
  +          if (readMethod != null) {
  +            Object invokeResult = readMethod.invoke(bean, new Object[0]);
  +            /* test and fetch from the map */
  +            if (invokeResult instanceof java.util.Map) {
  +              ((java.util.Map)invokeResult).put(key, value);
  +            }
  +          } else {
  +            throw new NoSuchMethodException("Property '" + name +
  +                    "' has no mapped getter method");
  +          }
           }
   
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message