ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Wooldridge" <>
Subject RE: Dynamic Configurator
Date Thu, 20 Mar 2003 20:14:39 GMT
Looking at the XDoclet code, I see this:

    public Object createDynamicElement(String name) throws BuildException
        if (!isModulesRegistered) {
            isModulesRegistered = true;

        SubTask subTask = (SubTask) getSubtaskMap().get(name);

        if (subTask == null) {
            throw new BuildException(...);

        return subTask;

This seems to imply that a new instance of a subtask is not
returned for each call to createDynamicElement(), but instead
a single instance (pulled from a map), is returned.

Is this the required behavior?  I can see why THAT code being
called twice would "do no harm".  However, my code (currently)
roughly looks like:

    public Object createDynamicElement(String name) throws BuildException
        if ("junit".equals(name)) {
            return new JUnitTask();

Which if called twice, of course, results in two JUnitTask objects
being created.


-----Original Message-----
From: Erik Hatcher []
Sent: Thursday, March 20, 2003 12:52 PM
To: Ant Developers List
Subject: Re: Dynamic Configurator


The latest XDoclet code uses it, and I've used it for my Lucene <index> 
task and other example tasks for the book, but never to the level 
you're trying it.  Perhaps the XDoclet implementation of it can help?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message