ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Häfelinger <whaefelin...@epo.org>
Subject Re: how to access a MacroDef?
Date Wed, 07 Jun 2006 07:07:55 GMT
>> So your 'def' is null, right?


Actually it's the case that 

        componenthelper.getTaskDefinitions().get(mymacroname);

returns a object of type Class:

        Class C = (Class) 
componenthelper.getTaskDefinitions().get(mymacroname);

In case 'mymacroname' contanis the name of a macrodef I'm getting


        C.getName() => 'org.apache.tools.ant.taskdefs.MacroInstance'


Still no clue how to get hold of my macro's definition. Peter, any hint?







"Dominique Devienne" <ddevienne@gmail.com> 
06-06-2006 19:41
Please respond to
"Ant Developers List" <dev@ant.apache.org>


To
"Ant Developers List" <dev@ant.apache.org>
cc

Subject
Re: how to access a MacroDef?






> I tried something like
>
>  ComponentHelper componenthelper =
> ComponentHelper.getComponentHelper(project());
>  MacroDef def = (MacroDef)
> componenthelper.getTaskDefinitions().get(mymacroname);
>
> just in order to understand that Hastable getTaskDefinitions() contains 
a
> String => Class relation.
>
> So where are those MacroDef's hidden?

So your 'def' is null, right?

Try not casting it to MacroDef, and see which kind of Java Class is
returned, if any. It may be an UnknownElement (my guess), a
MacroInstance, etc...

>From the UE, you may be able to get a MacroInstance or a MacroDef, and
if the later, configure it into a MacroInstance, which is what you
want to run.

I vaguely know this code only. Peter's the expert. --D

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




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


Mime
View raw message