Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 924639ADC for ; Tue, 21 Feb 2012 21:43:16 +0000 (UTC) Received: (qmail 70469 invoked by uid 500); 21 Feb 2012 21:43:14 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 70342 invoked by uid 500); 21 Feb 2012 21:43:14 -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 70280 invoked by uid 99); 21 Feb 2012 21:43:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Feb 2012 21:43:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Feb 2012 21:43:11 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3C1E31C263E for ; Tue, 21 Feb 2012 21:42:50 +0000 (UTC) Date: Tue, 21 Feb 2012 21:42:50 +0000 (UTC) From: "Simone Tripodi (Issue Comment Edited) (JIRA)" To: issues@commons.apache.org Message-ID: <1063712935.1123.1329860570247.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1605974116.2362.1329744994392.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (SANDBOX-396) [BeanUtils2] Implement clone() on DefaultBeanAccessor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SANDBOX-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13212981#comment-13212981 ] Simone Tripodi edited comment on SANDBOX-396 at 2/21/12 9:42 PM: ----------------------------------------------------------------- patch looks good, anyway: {code} + @SuppressWarnings( "unchecked" ) + B clone = (B) bean.getClass().newInstance(); + DefaultBeanAccessor cloneAccessor = new DefaultBeanAccessor( clone ); + cloneAccessor.populate( this.describe() ); + return clone; {code} * it is a good practice adding a comment that justifies why the unchecked warning can be suppressed; * the {{this.}} prefix can be omitted. We could even reuse the {{BeanUtils.on( beanType ).newInstance()}} chain that would help removing the duplicated code. Can you please apply these modifications and resubmit the patch? TIA, -Simo was (Author: simone.tripodi): patch looks good, anyway: {quote} + @SuppressWarnings( "unchecked" ) + B clone = (B) bean.getClass().newInstance(); + DefaultBeanAccessor cloneAccessor = new DefaultBeanAccessor( clone ); + cloneAccessor.populate( this.describe() ); + return clone; {quote} * it is a good practice adding a comment that justifies why the unchecked warning can be suppressed; * the {{this.}} prefix can be omitted. We could even reuse the {{BeanUtils.on( beanType ).newInstance()}} that would help removing the duplicated code. Can you please apply these modifications and resubmit the patch? TIA, -Simo > [BeanUtils2] Implement clone() on DefaultBeanAccessor > ----------------------------------------------------- > > Key: SANDBOX-396 > URL: https://issues.apache.org/jira/browse/SANDBOX-396 > Project: Commons Sandbox > Issue Type: Improvement > Components: BeanUtils2 > Affects Versions: Nightly Builds > Reporter: Benedikt Ritter > Attachments: SANDBOX-396.txt > > > Implement {{clone()}} on DefaultBeanAccessor: > * create a new instance of the same type as the bean encapsulated by the Accessor > * create a {{DefaultBeanAccessor}} for the new instance > * call populate on the new {{DefaultBeanAccessor}} with {{this.describe()}} as argument > * return the clone -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira