Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 19004 invoked from network); 25 Jun 2004 00:56:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jun 2004 00:56:12 -0000 Received: (qmail 70782 invoked by uid 500); 25 Jun 2004 00:56:30 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 70757 invoked by uid 500); 25 Jun 2004 00:56:30 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70739 invoked by uid 99); 25 Jun 2004 00:56:30 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [61.194.41.162] (HELO subdns1.tech.beacon-it.co.jp) (61.194.41.162) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 24 Jun 2004 17:56:29 -0700 Received: from tech.beacon-it.co.jp (tcint1 [172.22.160.204]) by subdns1.tech.beacon-it.co.jp (Postfix) with ESMTP id 79CABF26E8 for ; Fri, 25 Jun 2004 09:54:25 +0900 (JST) Received: from tech.beacon-it.co.jp (utvsrv.tech.beacon-it.co.jp [172.22.160.202]) by tech.beacon-it.co.jp (8.9.3 (PHNE_22672)/3.7Wpl2.01030916) with ESMTP id JAA01207 for ; Fri, 25 Jun 2004 09:55:26 +0900 (JST) Message-ID: <40DB7815.4050709@tech.beacon-it.co.jp> Date: Fri, 25 Jun 2004 09:55:49 +0900 From: Bill Keese User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040316 X-Accept-Language: ja, en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [Digester] Create an object using parent attribute References: <1088122169.26654.28.camel@pcsimon> <40DB6FA6.5040608@tech.beacon-it.co.jp> <1088123321.26657.37.camel@pcsimon> In-Reply-To: <1088123321.26657.37.camel@pcsimon> Content-Type: text/plain; charset=Shift_JIS Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N >How about this?? > >public class ChildCreationFactory implements ObjectCreationFactory { > public Object createObject(Attributes x) { > ParentClass parent = (ParentClass) digester.peek(); > String childClassName = parent.getChildClassName(); > > // create instance of child class and return it > } >} > > Looks good to me. I think that's what the original poster wanted. He just needs to add in the parts using reflection to instantiate the child object and set the attributes on it. Although, I guess the reflection code is a bit tricky, especially if there are type conversions, such as converting a string value of an attribute into a number. (Basically, it's re-implementing whatever digester.addSetProperties() does.) --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org