ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject [IDEA] Polymorphic types
Date Fri, 16 Nov 2001 13:50:01 GMT
Attached is a patch to the IntrospectionHelper to give a little 
ploymorphic behaviour for nested elements. I haven't committed this as I 
thought I'd get some reaction first.

Basically what this patch does is the following: When a nested creator 
cannot be found for a particular nested element, a check is done to see 
if the element corresponds to a datatype. If it does, a search is done 
for a superclass of the datatype for which the class does have an addXXX 
style creator.

In practice, this allows me to use derived types with core tasks without 
needing to change the core task. For example, if I wanted to use a 
classfileset type in a <copy> task, I do not need to change copy to add 
a addClassfileSet() method. I can just use this

     <copy todir="deptest">
       <classfileset dir="build/classes" 

Similarly, I can have classfilesets in jars without changing the <jar> 

It isn't perfect since some tasks use rolenames in their nested elements


For these tasks, the current method of refids needs to be used. 
Nevertheless, I think the patch is useful and makes it much more 
meaningful to define derived types.

The patch as it currently stands is just a proof of concept. There are 
some inefficiencies which can be factored out if required.

Let me know what you think?


View raw message