Package net.officefloor.servlet.inject
Class InjectContext
- java.lang.Object
-
- net.officefloor.servlet.inject.InjectContext
-
public class InjectContext extends java.lang.Object
Context for injection.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REQUEST_ATTRIBUTE_NAME
Name of attribute storing theInjectContext
.
-
Constructor Summary
Constructors Constructor Description InjectContext(SupplierThreadLocal<?>[] supplierThreadLocals)
Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Activates thisInjectContext
.static java.lang.Object
getActiveDependency(int dependencyIndex)
Obtains the dependency.void
synchroniseForAnotherThread()
Synchronises thisInjectContext
for anotherThread
.
-
-
-
Field Detail
-
REQUEST_ATTRIBUTE_NAME
public static final java.lang.String REQUEST_ATTRIBUTE_NAME
Name of attribute storing theInjectContext
.
-
-
Constructor Detail
-
InjectContext
public InjectContext(SupplierThreadLocal<?>[] supplierThreadLocals)
Instantiate.- Parameters:
supplierThreadLocals
- Listing ofSupplierThreadLocal
instances with indexes corresponding to dependency index.
-
-
Method Detail
-
getActiveDependency
public static java.lang.Object getActiveDependency(int dependencyIndex) throws java.lang.IllegalStateException
Obtains the dependency.- Parameters:
dependencyIndex
- Index of the dependency.- Returns:
- Dependency.
- Throws:
java.lang.IllegalStateException
- If invoked from an unmanagedThread
.
-
activate
public void activate()
Activates thisInjectContext
.
-
synchroniseForAnotherThread
public void synchroniseForAnotherThread()
Synchronises thisInjectContext
for anotherThread
.
-
-