Class InjectionGenerator
java.lang.Object
org.springframework.beans.factory.generator.InjectionGenerator
Generate the necessary code to
create a bean instance or inject dependencies.
The generator assumes a number of variables to be accessible:
beanFactory: the generalDefaultListableBeanFactoryinstanceContext: theBeanDefinitionRegistrar.BeanInstanceContextcallbackbean: the variable that refers to the bean instance
- Author:
- Stephane Nicoll, Brian Clozel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn theProtectedAccess.Optionsto use if protected access analysis is required for the specifiedMember.org.springframework.javapoet.CodeBlockwriteInjection(Member member, boolean required) Write the code to inject a value resolved byBeanDefinitionRegistrar.BeanInstanceContextin the specifiedMember.org.springframework.javapoet.CodeBlockwriteInstantiation(Executable creator) Write the necessary code to instantiate an object using the specifiedExecutable.
-
Constructor Details
-
InjectionGenerator
public InjectionGenerator()
-
-
Method Details
-
writeInstantiation
Write the necessary code to instantiate an object using the specifiedExecutable. The code is suitable to be assigned to a variable or used as a return statement.- Parameters:
creator- the executable to invoke to create an instance of the requested object- Returns:
- the code to instantiate an object using the specified executable
-
writeInjection
Write the code to inject a value resolved byBeanDefinitionRegistrar.BeanInstanceContextin the specifiedMember.- Parameters:
member- the field or method to injectrequired- whether the value is required- Returns:
- a statement that injects a value to the specified member
- See Also:
-
getProtectedAccessInjectionOptions
Return theProtectedAccess.Optionsto use if protected access analysis is required for the specifiedMember.- Parameters:
member- the field or method to handle- Returns:
- the options to use to analyse protected access
- See Also:
-