-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Assisted Injection via Factory Codegen #467
Conversation
Hmm, I can do better |
@Assisted
Prior to this commit the factory method had to match "create"
Noting that the generated AssistedFactory can't be injected into other components at compile time because it doesn't exist in the first compilation round
Adding tests. Noting that when there is no target factory the generated AssistedFactory can't be injected into other components (with compilation error I believe because it does not exist in the first compilation round). Thinking that we should make the target factory required at this stage - that feels like the correct thing to do at this stage. Later on if there is demand for not having a target factory interface then that can be revisited / looked at again. |
Fix qualifier determination, was ignoring qualifier annotations
hmm, this highlights another potential problem in that inject doesn't know how to handle beans that directly use generated code. |
Factory method with params generated from target factory interface. Parameter names must match.
Using AnnotationCopier to copy the inject annotation onto the method such that method injection occurs. DroidMethod now injected correctly.
@AssistFactory
a factory class is generated which will handle all managed injections while accepting user dependenciesNote the example below has been edited to reflect the built behaviour.
Given a factory interface with a single method:
A class with
@AssistFactory(CssFactory.class)
:An assist factory class will be generated. (Naturally, it too will be processed and have a DI class created)
Then the
CssFactory
can be used like:.will resolve #466