ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Atherton <br...@callenish.com>
Subject Re: Extending Ant [was RE: Comparing files in subdirectories]
Date Mon, 28 Oct 2002 22:54:03 GMT
At 11:03 AM 10/25/2002 -0500, Dominique Devienne wrote:
>I've looked at the extension mechanism of selectors, which uses
>Parameterizable, and I'd like to ask why a custom selector writer has to get
>his attributes that way instead of the normal way task and type benefit,
>i.e. using introspection?

You can write your selector either way, but if you write it the "normal" 
introspection way you will have to touch some of the standard Ant code. See 
http://jakarta.apache.org/ant/manual/CoreTypes/selectors-program.html for 
more info on how to do this if you want to, particularly the part about 
implementing core selectors.


>The same Paramerer/Parameterizable scheme might allow easier condition
>extension in the short term, but the Bean pattern is so much term, and the
>right Ant-way IMHO...

As I say, you are still able to do that if you want to. The custom selector 
option is available so that you can write your own selector and use it in 
all the tasks and selector containers without any change to the core ant code.

Since this is the developers list, here is the underlying issue. The 
binding of the XML to the java objects is done using the introspection of 
the method signatures in the classes, as you point out. So each selector 
container's class, for example, has an "addContains()", "addDepends()", 
etc. for each type of selector that Ant provides. When a user adds a new 
selector, the selector container code will not have an "addMynewselector()" 
method unless the user also changes the standard container code (or its 
base class).

So for those users that don't want to make those kinds of changes to the 
core code, all the selector containers (as well as AbstractFileset) have an 
"addCustom()" method that does the right thing using the Parameterizable 
mechanism that Magesh introduced with Filters (which have the same issue).



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message