Package net.officefloor.servlet.inject
Class InjectionRegistry
- java.lang.Object
-
- net.officefloor.servlet.inject.InjectionRegistry
-
public class InjectionRegistry extends java.lang.Object
Registry of injections.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description InjectionRegistry(FieldDependencyExtractor[] fieldDependencyExtractors)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InjectContextFactory
createInjectContextFactory()
Creates theInjectContextFactory
.void
forEachDependency(java.util.function.BiConsumer<java.lang.String,java.lang.Class<?>> visitor)
Iterate over all dependencies.<T> T
getDependency(java.lang.String qualifier, java.lang.Class<? extends T> type, SupplierSourceContext supplierContext)
Obtains the dependency.void
registerForInjection(java.lang.Class<?> clazz, SupplierSourceContext supplierContext)
Registers theClass
for injection.
-
-
-
Constructor Detail
-
InjectionRegistry
public InjectionRegistry(FieldDependencyExtractor[] fieldDependencyExtractors)
Instantiate.- Parameters:
fieldDependencyExtractors
-FieldDependencyExtractor
instances.
-
-
Method Detail
-
getDependency
public <T> T getDependency(java.lang.String qualifier, java.lang.Class<? extends T> type, SupplierSourceContext supplierContext)
Obtains the dependency.- Parameters:
qualifier
- Qualifier. May benull
.type
- Type.supplierContext
-SupplierSourceContext
.- Returns:
- Dependency.
-
registerForInjection
public void registerForInjection(java.lang.Class<?> clazz, SupplierSourceContext supplierContext) throws java.lang.Exception
Registers theClass
for injection.- Parameters:
clazz
-Class
to have dependencies injected.supplierContext
-SupplierSourceContext
for the dependencies.- Throws:
java.lang.Exception
- If fails to register for injection.
-
forEachDependency
public void forEachDependency(java.util.function.BiConsumer<java.lang.String,java.lang.Class<?>> visitor)
Iterate over all dependencies.- Parameters:
visitor
- Visitor for all dependencies.
-
createInjectContextFactory
public InjectContextFactory createInjectContextFactory()
Creates theInjectContextFactory
.- Returns:
InjectContextFactory
.
-
-