ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject Re: DataType interface?
Date Tue, 05 Jun 2001 11:07:54 GMT

----- Original Message -----
From: "Stefan Bodewig" <bodewig@apache.org>
To: <ant-dev@jakarta.apache.org>
Sent: Tuesday, June 05, 2001 5:23 PM
Subject: Re: DataType interface?


> Conor MacNeill <conor@cortexebusiness.com.au> wrote:
>
> > I have considered there to be three components to a datatype.
> > 1. The task level element used to create values of the datatype
> >
> >   <fileset name="foo" .../>
> >
> > 2. The nested element used to create an instance of the datatype
> > within the context of another task
> >
> >    <fubar ...>
> >        <fileset .../>
> >    </fubar>
>
> If you make these two the same class you get the same kind of problem
> we currently have in Ant1.  Say I invent my-improved-fileset and want
> task foo to support it (which already supports filesets), then I need
> to modify task foo (add an addMyImprovedFileset method to it).
>
> The workaround is something like
>
> <myimprovedfileset id="xyz"/>
> <foo>
>   <fileset refid="xyz" />
> </foo>
>
> which doesn't improve readabilty 8-)
>
> David Rees has posted a proposal to this list (a loong while ago, and
> I still haven't read it completely, shame on me) in which he outlines
> a scenario where
>
> <foo>
>   <fileset ....>
> </foo>
>
> would take into account all classes that could be passed to addFileset
> (subclasses of FileSet in this case, but the same holds true for
> arbitrary interfaces and implementing classes) and choose the one that
> fits the supplied attributes - this is where it becomes dangerous
> IMHO.
>
> I'm not sure whether I'd want to go *that* far.

How about this instead

<foo>
   <myimprovedfileset ...>
</foo>

When this is encountered and there is no createMyImprovedFileset,
introspection looks for an interface that is supported by both the
myimprovedfileset element and an nestedlementcreator of foo.

I haven't thought through the details here in terms of how the
introspection can perform that piece of magic but it seems doable and has
the advantage that the user's intent is explicit - no funky search for
potential matching types.

Conor



Mime
View raw message