> -----Original Message----- > From: Tim Dawson [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 30 January 2002 7:12 AM > To: [EMAIL PROTECTED] > Subject: Re: [IDEA] Polymorphic types > > > I like the idea of polymorphic types, but I'm not sure about this > type of implementation -
Agreed. I was not happy with the implemntation. That is why I have not proceeded with this in Ant 1.x. The idea is, however, pretty good, IMHO. It would solve the problem of extensibility in ejbjar, for example. I have experimented further in mutant, which supports polymorphism, including allowing add methods to be defined in terms of an interface. > it requires that the type be a subclass > of another type, and would prohibit interface implementation from > working. When I first ran into a similar issue a while back I got > to thinking that what would be a better approach would be to pair > this issue with the whole deployment descriptor issue, and have > each type optionally declare a "property" that would be used to > set it. (the DD issue comes into play because the third > declaration by necessity breaks the ability to use the simple > properties file to map the element name to the class) > > By default, the property could be the type itself, e.g. <path>'s > property would be "path", <and> and <or>'s property would be "condition". > I guess I don't really follow what you are proposing here. What I did in mutant is have the name of the nested element identify the add method which will be called. An ant:refid attribute can be used to identify an existing instance to be passed to the method. Alternatively, an ant:type attribute can be used to identify an Ant typdef'd type, an instance of which is to be created. Introspection/reflection proceeds using this type instance. Finally, if no ant:refid or ant:type is used, mutant will try to create an instance of the argument type of the add method. > I should (in between day-job and family commitments) be able to > post this some time this week. > > Does the general idea though, of actually registering the > property name work for people? I think it seems fairly obvious, > especially when the default is to use the element name. > Ummm, not sure. :-) Conor -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
