The difference is primarily to support objects which cannot be created by Ant. The addXXX methods require Ant to create the object. The class must therefore have a zero argument constructor. A createXXX method gives the task responsibility for object creation, allowing objects which don't have such a constructor to be used. Other than that there is no difference. In Ant 1.4, there will be an additional method signature checked, addConfiguredXXXX, which means Ant will create AND configure the object before giveing it to the task (the current addXXX give the task the object BEFORE it is configured)
Conor > -----Original Message----- > From: Weiqi Gao [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 29 August 2001 3:30 PM > To: [EMAIL PROTECTED] > Subject: Custom tasks question: difference between createXXX and addXXX > > > Hi, > > Here's a question from someone whose not on the list: > > <forwarded-message> > I'm trying to understand how to write custom > tasks in Ant. There are two potential methods > that I can use: > > public [Object] create[ElementName]() > > or > > public void add[ElementName]([Object] obj) > > The Ant user manual says this: > > "For each nested element, write a create or > add method. A create method must be a public > method that ..." > > They go on to describe the naming conventions, > but don't bother to say what is the difference > between "create" and "add". > </forwarded-message> > > I would appreciate a clarification. > > -- > Weiqi Gao > [EMAIL PROTECTED] > > >
