Interface Context<T>

    • Method Detail

      • getScope

        Class<? extends Annotation> getScope()
        The scope for which this is the context
        Returns:
        may not return null, must return the scope for which this is a context
      • findOrCreate

        <U> U findOrCreate​(ActiveDescriptor<U> activeDescriptor,
                           ServiceHandle<?> root)
        Creates a contextual instance of this ActiveDescriptor by calling its create method if there is no other matching contextual instance. If there is already a contextual instance it is returned. If parent is null then this must work like the find call
        Parameters:
        activeDescriptor - The descriptor to use when creating instances
        root - The extended provider for the outermost parent being created
        Returns:
        A context instance. This value may NOT be null
      • containsKey

        boolean containsKey​(ActiveDescriptor<?> descriptor)
        Determines if this context has a value for the given key
        Parameters:
        descriptor - The descriptor to look for in this context
        Returns:
        true if this context has a value associated with this descriptor
      • destroyOne

        void destroyOne​(ActiveDescriptor<?> descriptor)
        This method is called when ServiceHandle.destroy() method is called. It is up to the context implementation whether or not to honor this destruction request based on the lifecycle requirements of the context
        Parameters:
        descriptor - A non-null descriptor upon which ServiceHandle.destroy() has been called
      • supportsNullCreation

        boolean supportsNullCreation()
        Returns true if the findOrCreate method can return null
        Returns:
        true if null is a legal value from the findOrCreate method
      • isActive

        boolean isActive()
        True if this context is active, false otherwise
        Returns:
        true if this context is active, false otherwise
      • shutdown

        void shutdown()
        Shut down this context.