Class InjectContext


  • public class InjectContext
    extends java.lang.Object
    Context for injection.
    Author:
    Daniel Sagenschneider
    • Field Detail

      • REQUEST_ATTRIBUTE_NAME

        public static final java.lang.String REQUEST_ATTRIBUTE_NAME
        Name of attribute storing the InjectContext.
    • Constructor Detail

      • InjectContext

        public InjectContext​(SupplierThreadLocal<?>[] supplierThreadLocals)
        Instantiate.
        Parameters:
        supplierThreadLocals - Listing of SupplierThreadLocal 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 unmanaged Thread.
      • activate

        public void activate()
        Activates this InjectContext.
      • synchroniseForAnotherThread

        public void synchroniseForAnotherThread()
        Synchronises this InjectContext for another Thread.