ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Creating custom data container rather than task for use as nested element in a custom task
Date Thu, 08 Aug 2002 01:34:24 GMT


jlcarpenter@household.com wrote:
> I am still a bit confused as to when a class corresponding to a nested
> element should inherit from the org.apache.tools.ant.types.DataType class
> (i.e. the fairly simple org.apache.tools.ant.types.Substitution class).
> The answer seems to revolve around when one needs to use reference ids.

Exactly.  Datatypes are only needed if you want to define them and 
re-use them - and there are some hairy issues you need to take care of 
to do it right, I believe, and its best to cut-and-paste an existing 
datatype and adapt it to your needs to ensure you get the reference 
stuff implemented properly.

For most custom tasks, using the existing datatypes is sufficient, and 
then using your own custom classes without making those also "datatypes".

> I have access to the Oreilly Ant book via Safari http://safari.oreilly.com
> but have not found a good answer there.

No comment.  :)

> I do not yet own Erik and Steve's book published by Manning.  Is this
> question answered well there?

We do not cover writing custom datatypes, although we do cover the 
existing datatypes extensively, and how to use them in custom tasks.

There is not really much different in writing a custom datatype other 
than being sure you get the circular reference stuff caught, which is 
what you'll get by adapting an existing datatype to your own.  Give it a 
shot and let us know if you run into any troubles.  The <cc> task at 
Sourceforge is a great example of some datatypes implemented slickly 
(the ant-contrib project) - so if you're after something more advanced 
have a look there too.

	Erik



--
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