From: Conor MacNeill <[EMAIL PROTECTED]> Sorry for the delayed response... As you might have guessed, I am finally around to cleaning up some mails... ;-)
> 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. Idea to provide polymorphic behavior is great! > 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. +1 > 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" > baseclass="build/classes/org/apache/tools/ant/Main.class"/> > </copy> As Stefan said is his email, an interface/implementation model would be ideal. > It isn't perfect since some tasks use rolenames in their nested elements > > <blah> > <fromfileset> > <tofileset> > </blah> Maybe you could introduce an optional attribute named ispolymorphic to the <fileset> interface? This would by default be true. Users who do not want to use this feature would set this to false thereby overriding the polymorphic behavior. > Nevertheless, I think the patch is useful and makes it much more > meaningful to define derived types. I agree. > > Conor > Cheers, Magesh -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
