Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 2091 invoked from network); 10 Apr 2002 01:34:48 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 10 Apr 2002 01:34:48 -0000 Received: (qmail 23223 invoked by uid 97); 10 Apr 2002 01:34:56 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 23203 invoked by uid 97); 10 Apr 2002 01:34:56 -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 23186 invoked from network); 10 Apr 2002 01:34:55 -0000 X-Server-Uuid: 2e475a19-625a-11d4-bbee-00b0d049770d Message-ID: <271DE2625FD4D311949B009027F43B9F0EF8DEB9@us-mtvmail2.ariba.com> From: "Heath Chiavettone" To: "'commons-dev@jakarta.apache.org'" Subject: BeanUtils.populate() question Date: Tue, 9 Apr 2002 18:34:52 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) X-WSS-ID: 10AD4934158332-01-01 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C1E02F.E93A6E90" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C1E02F.E93A6E90 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I know that this package is mostly used by Struts but it is designed to be used generically. We are in the process of evolving to Struts, but it will take some time. So here is the scenario I'm thinking of using this in. In our (Model 1) world, we have designed our JSPs to be mated to a JavaBean which is used to process all of the data for the form. We are using a custom tag to "initialize" these beans on in the JSP and then use the mechanism in the JSP to "bind" the data to the bean. Recently, we have begun using a (Servlet 2.3) filter, to pre-processed the request and convert the String and String[] into the appropriate object types such Integer, BigDecimal, Long, and several other application-specific "primitive" types (using a custom mechanism) and stores them in the request as attributes (keyed to the parameter name). As a result, I can now create a Map that is keyed to the property name, but will contain the not only the basic String or String[] values for all "real" string properties, but also these other object types. Rather than using the setProperty * mechanism, I would like to modify the custom tag to use the BeanUtils package to improve our "binding" mechanism. In looking at the Javadoc (see below) for the populate method, I'm not to sure if what I want to do will work. I was wondering if the BeansUtil.populate() method could be used in the following manner: Parameters: bean - JavaBean whose properties are being populated properties - Map keyed by property name, with the corresponding (String or String[]) value(s) to be set So I guess I have couple of questions: 1. Can I use populate to accomplish my goal of binding the Map of the various property "Objects" to the appropriate bean properties? 2. If not, then will the PropertyUtils.set*() class of methods work? 3. If so, will I gain any of the Introspection performance gains that I believe BeanUtils.populate gives me? Thanks, Heath ------_=_NextPart_001_01C1E02F.E93A6E90--