DoclerLabs / hexMachina

Releases, issues, documentation, website of hexMachina, framework written in Haxe
http://hexmachina.org
MIT License
44 stars 8 forks source link

implements IAnnotationParsable is not enough to inject field values #192

Closed ivan-slepchenko closed 7 years ago

ivan-slepchenko commented 7 years ago

CLangTextList implements IAnnotationParsable but its not enough to have the fields injected, so I need to implement InjectorContainer too. This happens when i map it in a module, with injector.mapToASingleton

FrancisBourre commented 7 years ago

Yeah, because the only way to know something was instantiated behind the scenes is to receive a callback from the injector. Btw, there are few other way for doing it.

Neverbirth commented 7 years ago

I would say I don't agree on this one, as commented in the issue, the instance is created by the injector, not directly by the user, why should he know that in this case the annotations won't be parsed in the same way?

Also, why adding IInjectorContainer makes the difference in this case? I think I get the point myself, but I consider this should be documented somewhere.