dynamic injection at runtime
Hi people,
I just want to know if there exist a way to do something like these:
I have 2 named singletons in my context class
injector.mapSingleton(Yoola, 'jobs'); and injector.mapSingleton(Yoola, 'inputdata');
then some where in some class I do: [Inject (name='jobs')] public var _yoola:Yoola;
I would like to make the name string in [Inject (name='jobs')] dynamic, so I could set its value at runtime.
Is there a way to do this? if not, is there a way an Actor could retrieve the injected class in some way, maybe some thing like
var yoola:Yoola = injector.getSingleton(Yoola, 'inputdata') ?
Thanks in advance...
Comments are currently closed for this discussion. You can start a new one.
2 Posted by Michal Wroblewski on 31 May, 2011 06:42 AM
Inject IInjector into your actor and use injector.getInstance(YourClass, "mappingName")
BTW. Here's very useful API docs: http://robotlegs.org/api/
3 Posted by tzamora on 01 Jun, 2011 01:00 AM
Oh great, I searched on the best practices documents and in the internal documents, but I couldnt find something ...
anyway, thanks a lot ...
tzamora closed this discussion on 01 Jun, 2011 01:01 AM.
Joel Hooks re-opened this discussion on 01 Jun, 2011 06:08 PM
Support Staff 4 Posted by Joel Hooks on 01 Jun, 2011 06:08 PM
No, the metadata is "baked" in at runtime. It would require something of
this nature to accomplish:
http://www.jamesward.com/2011/04/26/introducing-mixing-loom-runtime-actionscript-bytecode-modification/
Which is well beyond the scope of RL :>
I'd create a YoolaListModel with a method like getYoolaByName(name:String)
that could be injected around.
On Mon, May 30, 2011 at 10:24 PM, tzamora <
***@tenderapp.com> wrote:
Stray closed this discussion on 10 Jun, 2011 03:07 PM.