On 2011-11-05, Benjamin de Dardel wrote:

> Hi all,

> I would like to add a dynamic element and instanciate it dynamically
> using 'instanceof' attribute.
> Something like that :

> <mytask>
> <mydynamicelement instanceof="my.first.class">
> <some-inner>
> </some-inner>
> </mydynamicelement>
> <mydynamicelement instanceof="my.second.class">
> <some-other-inner>
> </some-other-inner>
> </mydynamicelement>
> </mytask>

> I fail in using method : public Object createDynamicElement(String name),
> because I have to return the instance of my element before parsing its
> attributes.

> Do you have any idea to find a solution ?

None that would allow you to use an attribute as selector.  Maybe you
should revisit this requirement.  You could do something like 

<mytask>
  <my.first.class>
    <some-inner>
    </some-inner>
  </my.first.class>
  <my.second.class>
    <some-other-inner>
    </some-other-inner>
  </my.second.class>
</mytask>

or a combination of typedef/componentdef with add(Object) or
addConfigured(Object) instead.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to