Package de.simonkerstan.ee.core.di
Class DependencyInjectionHook
java.lang.Object
de.simonkerstan.ee.core.di.DependencyInjectionHook
- All Implemented Interfaces:
ClassHook,ClassInterfacesHook,ConstructorHook,MethodHook
public class DependencyInjectionHook
extends Object
implements ClassHook, ClassInterfacesHook, ConstructorHook, MethodHook
Hook for dependency injection used by the class scanning mechanism.
FOR INTERNAL USE ONLY. THE API CAN CHANGE AT ANY TIME.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBeanProvider(BeanProvider<?> beanProvider) Add a bean provider from a framework module.<T> TGet an instantiated bean of the given class.getBeans()Get all instantiated beans.Class<? extends Annotation>[]Get all annotations at the class level processed by this hook.Class<? extends Annotation>[]Get all annotations at the constructor level processed by this hook.Class<? extends Annotation>[]Get all annotations at the method level processed by this hook.voidProcess all scanned classes and methods to create beans and contexts.voidprocessClass(Class<?> clazz, Class<? extends Annotation> annotation, Annotation annotationInstance) Process the given class with the given annotation.voidprocessClassInterfaces(Class<?> clazz, Class<?>[] interfaces) Process all interfaces directly implemented by the given class.voidprocessConstructor(Constructor<?> constructor, Class<? extends Annotation> annotation, Annotation annotationInstance) Process the given constructor with the given annotation.voidprocessMethod(Method method, Class<? extends Annotation> annotation, Annotation annotationInstance) Process the given method with the given annotation.
-
Constructor Details
-
DependencyInjectionHook
public DependencyInjectionHook()
-
-
Method Details
-
getClassAnnotations
Description copied from interface:ClassHookGet all annotations at the class level processed by this hook.- Specified by:
getClassAnnotationsin interfaceClassHook- Returns:
- Class annotations processed by this hook
-
getConstructorAnnotations
Description copied from interface:ConstructorHookGet all annotations at the constructor level processed by this hook.- Specified by:
getConstructorAnnotationsin interfaceConstructorHook- Returns:
- Constructor annotations processed by this hook
-
getMethodAnnotations
Description copied from interface:MethodHookGet all annotations at the method level processed by this hook.- Specified by:
getMethodAnnotationsin interfaceMethodHook- Returns:
- Method annotations processed by this hook
-
processClass
public void processClass(Class<?> clazz, Class<? extends Annotation> annotation, Annotation annotationInstance) Description copied from interface:ClassHookProcess the given class with the given annotation.- Specified by:
processClassin interfaceClassHook- Parameters:
clazz- Class to be processedannotation- Annotation to be processedannotationInstance- Annotation instance to be processed
-
processClassInterfaces
Description copied from interface:ClassInterfacesHookProcess all interfaces directly implemented by the given class. This method will only be called for real classes, not for interfaces or other types.- Specified by:
processClassInterfacesin interfaceClassInterfacesHook- Parameters:
clazz- Class to processinterfaces- Directly implemented interfaces of the given class
-
processConstructor
public void processConstructor(Constructor<?> constructor, Class<? extends Annotation> annotation, Annotation annotationInstance) Description copied from interface:ConstructorHookProcess the given constructor with the given annotation.- Specified by:
processConstructorin interfaceConstructorHook- Parameters:
constructor- Constructor to be processedannotation- Annotation to be processedannotationInstance- Annotation instance to be processed
-
processMethod
public void processMethod(Method method, Class<? extends Annotation> annotation, Annotation annotationInstance) Description copied from interface:MethodHookProcess the given method with the given annotation.- Specified by:
processMethodin interfaceMethodHook- Parameters:
method- Method to be processedannotation- Annotation to be processedannotationInstance- Annotation instance to be processed
-
addBeanProvider
Add a bean provider from a framework module.- Parameters:
beanProvider- Bean provider to be added
-
getBean
Get an instantiated bean of the given class.- Type Parameters:
T- Bean type- Parameters:
clazz- Class of the bean- Returns:
- Bean instance or null if not found
-
getBeans
Get all instantiated beans.- Returns:
- Beans
-
postProcess
public void postProcess()Process all scanned classes and methods to create beans and contexts.
-