Package net.officefloor.servlet.inject
Class InjectionRegistry
java.lang.Object
net.officefloor.servlet.inject.InjectionRegistry
Registry of injections.
- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionInjectionRegistry(FieldDependencyExtractor[] fieldDependencyExtractors) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionCreates theInjectContextFactory.voidforEachDependency(BiConsumer<String, Class<?>> visitor) Iterate over all dependencies.<T> TgetDependency(String qualifier, Class<? extends T> type, SupplierSourceContext supplierContext) Obtains the dependency.voidregisterForInjection(Class<?> clazz, SupplierSourceContext supplierContext) Registers theClassfor injection.
-
Constructor Details
-
InjectionRegistry
Instantiate.- Parameters:
fieldDependencyExtractors-FieldDependencyExtractorinstances.
-
-
Method Details
-
getDependency
public <T> T getDependency(String qualifier, Class<? extends T> type, SupplierSourceContext supplierContext) Obtains the dependency.- Type Parameters:
T- Type of the dependency.- Parameters:
qualifier- Qualifier. May benull.type- Type.supplierContext-SupplierSourceContext.- Returns:
- Dependency.
-
registerForInjection
public void registerForInjection(Class<?> clazz, SupplierSourceContext supplierContext) throws Exception Registers theClassfor injection.- Parameters:
clazz-Classto have dependencies injected.supplierContext-SupplierSourceContextfor the dependencies.- Throws:
Exception- If fails to register for injection.
-
forEachDependency
Iterate over all dependencies.- Parameters:
visitor- Visitor for all dependencies.
-
createInjectContextFactory
Creates theInjectContextFactory.- Returns:
InjectContextFactory.
-