ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: create or add subtask??
Date Mon, 03 Jun 2002 12:20:09 GMT
Laval Chung wrote:
> For subtask we either create or add?
> What's the difference and when to use which?
> 
> Cheers
> laval
> 

When you use addXXX, Ant will instantiate the object, pass it to the add 
method and then configure it. For Ant to be able to instantiate the class it 
must support a Zero Argument Constructor (ZAC).

When you use createXXX, Ant will call createXXX and your task must create 
the sub-object and return it to Ant which will then configure it. As such 
your task can create the sub-object with whatever means available.

BTW, the above is the simple explanation :-).

In general, the preference nowadays is to use addXXX methods. These are more 
extensible since Ant can provide a subclass of the class required by the 
addXXX methods. That isn't much of an issue today but in the future such 
behaviour is envisaged.

Also, it is not strictly a sub-task - more a sub-element.

Conor



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message