Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@apache.org Received: (qmail 5689 invoked from network); 25 Mar 2002 11:57:36 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 25 Mar 2002 11:57:36 -0000 Received: (qmail 1124 invoked by uid 97); 25 Mar 2002 11:57:29 -0000 Delivered-To: qmlist-jakarta-archive-ant-user@jakarta.apache.org Received: (qmail 1108 invoked by uid 97); 25 Mar 2002 11:57:29 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 1097 invoked from network); 25 Mar 2002 11:57:28 -0000 Content-Type: text/plain; charset="iso-8859-1" From: stephan beal To: "Ant Users List" , David.Bailey@lawson.com Subject: Re: createXXX and addXXX in custom tasks Date: Mon, 25 Mar 2002 12:57:24 +0100 X-Mailer: KMail [version 1.3.2] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Monday 25 March 2002 12:45 pm, David.Bailey@lawson.com wrote: > Howdy. > > I've spent a fair amount of time poring over both the source code > and the docs, and I'm still a bit confused about how to use the > createXXX and addXXX methods for nested elements of a custom > task. The following text was from Adam Murdoch, posted this weekend on ant-dev when i had the same question: ================================== >�Can someone tell me what the technical difference is between addXXX() and >�createXXX()? i was thinking that you "add" command-line args to >�an ExecTask, >�but it has no addXXX() (it has only createXXX()). > The difference is mainly in where the object gets instantiated. �For an addX() method, Ant instantiates it. �For a createX() method, the task/type instantiates it. Here's how a element is handled using an addFoo( Type arg ) method: - Create a new instance of Type, using the no-args constructor. - Call addFoo() to hand the object to the task/type. - Configure the object using the element. Here's how the element is handled using a Type createFoo() method: - Create an instance of Type, by calling createFoo(). �The task/type creates the instance however it wants. - Configure the object using the element. There's actually a third type of method, the addConfiguredX() method, that is a variation of addX(). �A element is handled using addConfiguredFoo( Type arg ) method: - Create a new instance of Type, using the no-args constructor. - Configure the object using the element. - Call addConfiguredFoo() to hand the object to the task/type. I suggest using addX() or addConfiguredX() where possible. ====================================================== ----- stephan Generic Unix Computer Guy stephan@einsurance.de - http://www.einsurance.de Office: +49 (89) �552 92 862 Handy: �+49 (179) 211 97 67 "...control is a degree of inhibition, and a system which is perfectly inhibited is completely frozen." -- Alan W. Watts -- To unsubscribe, e-mail: For additional commands, e-mail: