robotlegs / robotlegs-framework

An ActionScript 3 application framework for Flash and Flex
https://robotlegs.tenderapp.com/
MIT License
967 stars 261 forks source link

Errors when trying to inject view into mediator using interface instead of view class #59

Closed pixels4nickels closed 12 years ago

pixels4nickels commented 12 years ago

In my config class:

    [PostConstruct]
    public function init():void
    {
        mediatorMap.mapView(iAppView).toMediator(AppViewMediator);
        commandMap.map(TestSignal).toCommand(TestCommand);
    }

This throws an error: Error: Injector is missing a mapping to handle injection into property "view" of object "[object AppViewMediator]" with type "[class AppViewMediator]". Target dependency: "views.api::iAppView|" at org.swiftsuspenders.typedescriptions::PropertyInjectionPoint/applyInjection()[/Users/till/dev/swiftsuspenders/swiftsuspenders/src/org/swiftsuspenders/typedescriptions/PropertyInjectionPoint.as:48] at org.swiftsuspenders::Injector/applyInjectionPoints()[/Users/till/dev/swiftsuspenders/swiftsuspenders/src/org/swiftsuspenders/Injector.as:468] at org.swiftsuspenders::Injector/org.swiftsuspenders.internal::instantiateUnmapped()[/Users/till/dev/swiftsuspenders/swiftsuspenders/src/org/swiftsuspenders/Injector.as:403] at org.swiftsuspenders::Injector/getInstance()[/Users/till/dev/swiftsuspenders/swiftsuspenders/src/org/swiftsuspenders/Injector.as:331] at robotlegs.bender.extensions.mediatorMap.impl::MediatorFactory/createMediator()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorFactory.as:60] at robotlegs.bender.extensions.mediatorMap.impl::MediatorMapping/createMediator()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorMapping.as:98] at robotlegs.bender.extensions.mediatorMap.impl::MediatorViewHandler/handleView()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorViewHandler.as:77] at robotlegs.bender.extensions.mediatorMap.impl::MediatorMap/handleView()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/mediatorMap/impl/MediatorMap.as:79] at robotlegs.bender.extensions.viewManager.impl::ContainerBinding/handleView()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/viewManager/impl/ContainerBinding.as:93] at robotlegs.bender.extensions.viewManager.impl::StageObserver/onViewAddedToStage()[/Users/krogers/Git/robotlegs-framework/src/robotlegs/bender/extensions/viewManager/impl/StageObserver.as:94]

I am trying to update my simple example app for an extension I am working on. This was working before using this line: mediatorMap.map(iAppView).toMediator(AppViewMediator); instead iof mediatorMap.mapView(iAppView).toMediator(AppViewMediator);

But it seems I can no longer use "map". Not sure if that helps!

pixels4nickels commented 12 years ago

is there an odd character hanging around in here? "views.api::iAppView|" ... maybe it should be "views.api::iAppView" ?

darscan commented 12 years ago

Howdy, can you try with .asType(iAppView) at the end?

pixels4nickels commented 12 years ago

Maybe my issue is more about how to now map interfaces. mediatorMap.map requires a Matcher interface and mediator.mapView does not like seem to find mapping matches for interfaces.

pixels4nickels commented 12 years ago

Nice!! That was it..and makes great sense: mediator.mapView(AppView).toMediator(AppViewMediator).asType(IappView);

pixels4nickels commented 12 years ago

need to fix my guards stuff then will push fixes to signalCommandMap

darscan commented 12 years ago

ok rad. btw, that | comes from swiftsuspenders - it's used to separate the fully qualified class name from the mapping name (which is usually blank).

pixels4nickels commented 12 years ago

Cool, good to know. I figured it was something like a describe markup.

darscan commented 12 years ago

just to let you know, asType has been removed. You can now just use mapView(ISomeView) and it will use that as the type to inject (as it did before).

pixels4nickels commented 12 years ago

My example app updated and pushed..thanks for the heads up. On Jan 26, 2012 8:08 AM, "Shaun Smith" < reply@reply.github.com> wrote:

just to let you know, asType has been removed. You can now just use mapView(ISomeView) and it will use that as the type to inject (as it did before).


Reply to this email directly or view it on GitHub:

https://github.com/robotlegs/robotlegs-framework/issues/59#issuecomment-3671212