-
Notifications
You must be signed in to change notification settings - Fork 114
Factory and Member Injector registries
Both Factories and Member Injectors are generated by Toothpick annotation processors. Factories allow to create instances, whereas Member Injectors allow to assign @Inject
annotated fields and call @Inject
annotated methods.
FactoryRegistries and MemberInjectorRegistries allow Toothpick to retrieve the factory and member injector associated to a class C.
Toothpick generates the registries at the same time it generates the factories and member injectors. As a developer using Toothpick, you need to
- configure the package into which the annotation processor will generate the registries for a given compilation unit (the application and each library);
- inform the toothpick annotation processor of possible dependency of your compilation unit : toothpick will need to know where to find the registries for each of them.
Application
|
+ --- Lib 1
|
\ -+- Lib 2
|
\--- Lib 3
When Toothpick create instances or inject member of instances of a class C
, it needs to find the factory and member injector associated to C
. Toothpick will not only look for the factory or member injector class, but also to instantiate it to use this instance (via the Factory and MemberInjector interfaces).
As Toothpick doesn't use any reflection, it needs a lookup mechanism to find the factory or member injector instance. FactoryRegistries and MemberInjectorRegistries provide this mechanism. Registries are a simple mapping of type
Each type of registry is organized in a tree. Typically the application ...
Everything needs to be compiled with Toothpick TODO