On Monday 25 March 2002 12:45 pm, [EMAIL PROTECTED] 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 <foo> 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 <foo> 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 <foo> element.

There's actually a third type of method, the addConfiguredX() method, that
is a variation of addX(). �A <foo> element is handled using
addConfiguredFoo( Type arg ) method:

- Create a new instance of Type, using the no-args constructor.
- Configure the object using the <foo> element.
- Call addConfiguredFoo() to hand the object to the task/type.

I suggest using addX() or addConfiguredX() where possible.
======================================================

----- stephan
Generic Unix Computer Guy
[EMAIL PROTECTED] - 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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to