commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MethodUtils.java
Date Thu, 15 Aug 2002 20:21:28 GMT
rdonkin     2002/08/15 13:21:27

  Modified:    beanutils/src/java/org/apache/commons/beanutils
                        MethodUtils.java
  Log:
  Optimized slow method by checking to see if the method can be found directly before going
through all the class methods.
  
  Revision  Changes    Path
  1.12      +8 -0      jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MethodUtils.java
  
  Index: MethodUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/MethodUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MethodUtils.java	1 Aug 2002 18:30:11 -0000	1.11
  +++ MethodUtils.java	15 Aug 2002 20:21:27 -0000	1.12
  @@ -517,6 +517,14 @@
               log.trace("Matching name=" + methodName + " on " + clazz);
           }
           
  +        // see if we can find the method directly
  +        // most of the time this works and it's much faster
  +        try {
  +            Method method = clazz.getMethod(methodName, parameterTypes);
  +            return method;
  +            
  +        } catch (NoSuchMethodException e) { /* SWALLOW */ }
  +        
           // search through all methods 
           int paramSize = parameterTypes.length;
           Method[] methods = clazz.getMethods();
  
  
  

--
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