From commons-dev-return-14037-qmlist-jakarta-archive-commons-dev=jakarta.apache.org@jakarta.apache.org Thu Aug 15 20:21:36 2002 Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 74958 invoked from network); 15 Aug 2002 20:21:34 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 15 Aug 2002 20:21:34 -0000 Received: (qmail 24644 invoked by uid 97); 15 Aug 2002 20:22:02 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 24601 invoked by uid 97); 15 Aug 2002 20:22:01 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 24590 invoked by uid 97); 15 Aug 2002 20:22:01 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 15 Aug 2002 20:21:28 -0000 Message-ID: <20020815202128.40683.qmail@icarus.apache.org> From: rdonkin@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils MethodUtils.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: For additional commands, e-mail: