ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: [Patch] es to be submitted
Date Fri, 11 Apr 2003 14:46:29 GMT
Actually, that's interesting, and somewhat freaky because last night when I
was having trouble falling asleep, I thought some more about my DynamicTag
class, and I actually thought of stuff that could solve that particular use
case ;-)

See DynamicTag implements DynamicConfigurator, and you normal compose a
dynatag within your task (both examples I provided), but you can also make
your task itself implement DynamicConfigurator, and forward the call to a
pre-initializes private dynatag. Provided that the task then forwards the
maybeConfigure() call to the private dynatag, it's functionally equivalent,
except you can put any element that's the required type (FileSet in this
case) directly inside the task, instead of within the nested dynatag
instead.

The snag if that if you do that, you can have only one such implicit
dynatag, parametrized on a single expect type (can take an array of types to
satisfy, but applies AND logic on them). But then again you can still using
composition if you need to do polymorphism for several 'types' of
sub-element.

Nodoby looked at DynamicTag, so I guess I'm the only one seeing this ;-)

Cheers, --DD

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@apache.org] 
Sent: Friday, April 11, 2003 9:36 AM
To: dev@ant.apache.org
Subject: Re: [Patch] es to be submitted

On Fri, 11 Apr 2003, Dominique Devienne <DDevienne@lgc.com> wrote:

> What's going on around the idea of Polymorphism in Ant? (beyond
> <datatype refid="xyz" /> that is)

The idea is to enable

<copy ...>
  <zipfileset src="foo.zip"/>
</copy>

or

<copy ...>
  <fileset src="foo.zip" ant:type="zipfileset"/>
</copy>

or something similar without doing anything in copy to make it aware
of ZipFileSet.

Mime
View raw message