Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 42283 invoked from network); 21 Feb 2009 01:24:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Feb 2009 01:24:24 -0000 Received: (qmail 86693 invoked by uid 500); 21 Feb 2009 01:24:23 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 86628 invoked by uid 500); 21 Feb 2009 01:24:22 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 86617 invoked by uid 99); 21 Feb 2009 01:24:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Feb 2009 17:24:22 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Feb 2009 01:24:22 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1A9C7234C4AA for ; Fri, 20 Feb 2009 17:24:02 -0800 (PST) Message-ID: <891261136.1235179442108.JavaMail.jira@brutus> Date: Fri, 20 Feb 2009 17:24:02 -0800 (PST) From: "Adam Hardy (JIRA)" To: issues@commons.apache.org Subject: [jira] Issue Comment Edited: (BEANUTILS-228) [beanutils] ConvertUtilsBean: register converter for specific property MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BEANUTILS-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675520#action_12675520 ] adam.hardy@cyberspaceroad.com edited comment on BEANUTILS-228 at 2/20/09 5:22 PM: --------------------------------------------------------------- I think it would be a great thing to enhance the converter.convert method signature to pass in the owning class's setter or getter method or field, from which it's possible to deduce the parameterized type for lists, sets, maps etc. This would help when trying to construct a list of a specific bean for instance. List getMyParticularBeans() This type info is erased at compilation from the List class itself - it is only the methods or field which still hold the info. was (Author: adam.hardy@cyberspaceroad.com): I think it would be a great thing to pass in the setter or getter method or field, from which it's possible to deduce the parameterized type for lists, sets, maps etc. This would help when trying to construct a list of a specific bean for instance. List getMyParticularBeans() This type info is erased at compilation from the List class itself - it is only the methods or field which still hold the info. > [beanutils] ConvertUtilsBean: register converter for specific property > ---------------------------------------------------------------------- > > Key: BEANUTILS-228 > URL: https://issues.apache.org/jira/browse/BEANUTILS-228 > Project: Commons BeanUtils > Issue Type: Improvement > Components: ConvertUtils & Converters > Affects Versions: 1.5 > Environment: Operating System: other > Platform: Other > Reporter: Michael Schuerig > Priority: Minor > Fix For: LATER THAN 1.8.0 > > > Currently, converters are selected only based on the class to which they > convert objects. In general this works pretty well, but I've encountered > cases, where this doesn't work out. > > For example, I'm using java.util.Date objects to represent points and > intervals in time that are not completely specific, such as day of the week > and month. Now I can easily write a Converter that uses SimpleDateFormat to > convert string representations of these dates ("Mon", "Feb") to Date objects. > > When I register one of these converters with ConvertUtils(Bean), though, it > preempts any conversion to Date. Something I clearly don't want as I have to > deal with different kinds of dates. > > As a solution, I'd like to be able to register a converter for a specific > property of a bean class, with a method this > > ConvertUtilsBean#register(Converter converter, java.lang.Class > destinationClass, java.lang.Class beanClass, java.lang.String propertyName) > > Michael -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.