Package net.officefloor.servlet.inject
Class InjectContext
- java.lang.Object
-
- net.officefloor.servlet.inject.InjectContext
-
public class InjectContext extends java.lang.ObjectContext for injection.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringREQUEST_ATTRIBUTE_NAMEName 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 voidactivate()Activates thisInjectContext.static java.lang.ObjectgetActiveDependency(int dependencyIndex)Obtains the dependency.voidsynchroniseForAnotherThread()Synchronises thisInjectContextfor 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 ofSupplierThreadLocalinstances with indexes corresponding to dependency index.
-
-
Method Detail
-
getActiveDependency
public static java.lang.Object getActiveDependency(int dependencyIndex) throws java.lang.IllegalStateExceptionObtains 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 thisInjectContextfor anotherThread.
-
-