ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: adding dynamic element
Date Mon, 07 Nov 2011 05:16:50 GMT
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-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message