Interface WeldManager

  • All Superinterfaces:
    jakarta.enterprise.inject.spi.BeanContainer, jakarta.enterprise.inject.spi.BeanManager, Serializable

    public interface WeldManager
    extends jakarta.enterprise.inject.spi.BeanManager, Serializable
    Functionality provided by the Weld Manager over and above the BeanManager.
    Author:
    Pete Muir
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      <T> jakarta.enterprise.inject.spi.AnnotatedType<T> createAnnotatedType​(Class<T> type, String id)
      Obtain an AnnotatedType that may be used to read the annotations of the given class or interface.
      <T> WeldCreationalContext<T> createCreationalContext​(jakarta.enterprise.context.spi.Contextual<T> contextual)  
      <T> jakarta.enterprise.inject.spi.InjectionTarget<T> createInjectionTarget​(EjbDescriptor<T> descriptor)
      The injection target for the given EJB, or null if Weld was not given this descriptor in the deployment.
      <T> WeldInjectionTargetBuilder<T> createInjectionTargetBuilder​(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
      Returns a new instance of WeldInjectionTargetBuilder which can be used to create a new WeldInjectionTarget for the specified type.
      <T> void disposeAnnotatedType​(Class<T> type, String id)
      Dispose the AnnotatedType created for the identified type.
      <X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget​(jakarta.enterprise.inject.spi.AnnotatedType<X> type)
      Fire a ProcessInjectionTarget event for the given type.
      <X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget​(jakarta.enterprise.inject.spi.AnnotatedType<X> annotatedType, jakarta.enterprise.inject.spi.InjectionTarget<X> injectionTarget)
      Fire a ProcessInjectionTarget event for the given type.
      default Collection<jakarta.enterprise.context.spi.Context> getActiveContexts()
      Returns an unmodifiable collection of all currently active Contexts.
      default Collection<WeldAlterableContext> getActiveWeldAlterableContexts()
      Returns an unmodifiable collection of all currently active Contexts that implement WeldAlterableContext.
      <T> jakarta.enterprise.inject.spi.Bean<T> getBean​(EjbDescriptor<T> descriptor)
      Get the Bean object for the given EJB, or null if Weld was not given this descriptor in the deployment.
      <T> EjbDescriptor<T> getEjbDescriptor​(String ejbName)
      Get the EjbDescriptor for the given EJB name
      String getId()
      The ID of the manager, identical to the ID provided by the BDA
      <T> WeldInjectionTargetFactory<T> getInjectionTargetFactory​(jakarta.enterprise.inject.spi.AnnotatedType<T> type)  
      jakarta.enterprise.inject.spi.Bean<?> getPassivationCapableBean​(BeanIdentifier identifier)  
      Collection<Class<? extends Annotation>> getScopes()
      Returns an unmodifiable collection of all registered scopes, both built-in and custom.
      ServiceRegistry getServices()
      Get the services registered for this manager
      jakarta.enterprise.inject.Instance<Object> instance()  
      boolean isContextActive​(Class<? extends Annotation> scopeType)
      Indicates whether there is an active context for a given scope.
      WeldManager unwrap()  
      • Methods inherited from interface jakarta.enterprise.inject.spi.BeanContainer

        createInstance, getBeans, getBeans, getContext, getEvent, getInjectableReference, getReference, isInterceptorBinding, isNormalScope, isQualifier, isScope, isStereotype, resolve, resolveInterceptors
      • Methods inherited from interface jakarta.enterprise.inject.spi.BeanManager

        areInterceptorBindingsEquivalent, areQualifiersEquivalent, createAnnotatedType, createBean, createBean, createBeanAttributes, createBeanAttributes, createInjectionPoint, createInjectionPoint, createInterceptionFactory, getELResolver, getExtension, getInterceptorBindingDefinition, getInterceptorBindingHashCode, getPassivationCapableBean, getProducerFactory, getProducerFactory, getQualifierHashCode, getStereotypeDefinition, isPassivatingScope, resolveDecorators, resolveObserverMethods, validate, wrapExpressionFactory
    • Method Detail

      • createInjectionTarget

        <T> jakarta.enterprise.inject.spi.InjectionTarget<T> createInjectionTarget​(EjbDescriptor<T> descriptor)
        The injection target for the given EJB, or null if Weld was not given this descriptor in the deployment. This should be used to create and inject contextual EJBs by the EJB container. Can also be used for message driven beans, even though they are non-contextual. fireProcessInjectionTarget(AnnotatedType) and fireProcessInjectionTarget(AnnotatedType, InjectionTarget) must be used to obtain an InjectionTarget for non-contextual EJB injection.
        Type Parameters:
        T - the type of the EJB
        Parameters:
        descriptor - the given EJB descriptor
        Returns:
        the injection target for the given EJB
      • getBean

        <T> jakarta.enterprise.inject.spi.Bean<T> getBean​(EjbDescriptor<T> descriptor)
        Get the Bean object for the given EJB, or null if Weld was not given this descriptor in the deployment.
        Type Parameters:
        T - the type of the bean
        Parameters:
        descriptor - the given EJB descriptor
        Returns:
        the Bean object for the given EJB
      • getEjbDescriptor

        <T> EjbDescriptor<T> getEjbDescriptor​(String ejbName)
        Get the EjbDescriptor for the given EJB name
        Type Parameters:
        T - the type of the EJB
        Parameters:
        ejbName - the given EJB name
        Returns:
        the EjbDescriptor for the given EJB name
      • getServices

        ServiceRegistry getServices()
        Get the services registered for this manager
        Returns:
        the services registered for this manager
      • fireProcessInjectionTarget

        <X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget​(jakarta.enterprise.inject.spi.AnnotatedType<X> type)
        Fire a ProcessInjectionTarget event for the given type. A helper method to allow integration code to easily fire the ProcessInjectionTarget for Java EE component classes supporting injection The container must use the returned InjectionTarget to inject the Java EE component.
        Type Parameters:
        X - the type
        Parameters:
        type - the type
        Returns:
        final version of InjectionTarget after all observers have been invoked
      • fireProcessInjectionTarget

        <X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget​(jakarta.enterprise.inject.spi.AnnotatedType<X> annotatedType,
                                                                                        jakarta.enterprise.inject.spi.InjectionTarget<X> injectionTarget)
        Fire a ProcessInjectionTarget event for the given type. A helper method to allow integration code to easily fire the ProcessInjectionTarget for Java EE component classes supporting injection The container must use the returned InjectionTarget to inject the Java EE component.
        Type Parameters:
        X - the type
        Parameters:
        annotatedType - the type
        injectionTarget - the injection target
        Returns:
        final version of InjectionTarget after all observers have been invoked
      • getId

        String getId()
        The ID of the manager, identical to the ID provided by the BDA
        Returns:
        the ID of the manager
      • instance

        jakarta.enterprise.inject.Instance<Object> instance()
        Returns:
        a new Instance with required type Object and no required qualifiers (Default is added automatically during resolution if no qualifiers are selected)
        See Also:
        CDI-671
      • getInjectionTargetFactory

        <T> WeldInjectionTargetFactory<T> getInjectionTargetFactory​(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
        Specified by:
        getInjectionTargetFactory in interface jakarta.enterprise.inject.spi.BeanManager
      • createCreationalContext

        <T> WeldCreationalContext<T> createCreationalContext​(jakarta.enterprise.context.spi.Contextual<T> contextual)
        Specified by:
        createCreationalContext in interface jakarta.enterprise.inject.spi.BeanContainer
      • getPassivationCapableBean

        jakarta.enterprise.inject.spi.Bean<?> getPassivationCapableBean​(BeanIdentifier identifier)
      • unwrap

        WeldManager unwrap()
        Returns:
        an unwrapped instance (e.g. the delegate in the case of forwarding implementation)
      • createAnnotatedType

        <T> jakarta.enterprise.inject.spi.AnnotatedType<T> createAnnotatedType​(Class<T> type,
                                                                               String id)
        Obtain an AnnotatedType that may be used to read the annotations of the given class or interface.

        Allows multiple annotated types, based on the same underlying type, to be created. AnnotatedTypes discovered by the container use the fully qualified class name to identify the type.

        This method must only be used when creating non-contextual instances, such as Java EE components. It's not designed to work with contextual instances.

        If called after the container bootstrap finished, the client code is required to explicitly call disposeAnnotatedType(Class, String) as soon as the specified type should be garbage-collected (to avoid memory leaks).

        Type Parameters:
        T - holds information about the class type
        Parameters:
        type - underlying class for the AnnotatedType
        id - unique ID of this newly created AnnotatedType
        Returns:
        the AnnotatedType
      • disposeAnnotatedType

        <T> void disposeAnnotatedType​(Class<T> type,
                                      String id)
        Dispose the AnnotatedType created for the identified type.

        This method should be explicitly called for each result of createAnnotatedType(Class, String) created after the container bootstrap finished.

        It's not necessary to call this method unless the identified type should be a subject of garbage collection.

        Type Parameters:
        T - holds information about the class type
        Parameters:
        type - underlying class for the AnnotatedType
        id - unique ID of the AnnotatedType that is to be destroyed
        See Also:
        createAnnotatedType(Class, String)
      • isContextActive

        boolean isContextActive​(Class<? extends Annotation> scopeType)
        Indicates whether there is an active context for a given scope.
        Parameters:
        scopeType - an annotation representing the scope
        Returns:
        true if there is an active context for a given scope, false otherwise
        Throws:
        IllegalStateException - if there are multiple active contexts for a given scope
      • getScopes

        Collection<Class<? extends Annotation>> getScopes()
        Returns an unmodifiable collection of all registered scopes, both built-in and custom. You can then use BeanManager#getContext() to retrieve the Context. The method returns scopes regardless of whether their respective contexts are active or otherwise.
        Returns:
        All scopes present in the application
      • getActiveContexts

        default Collection<jakarta.enterprise.context.spi.Context> getActiveContexts()
        Returns an unmodifiable collection of all currently active Contexts. This is just a convenient method. Note that for each scope, there might be more than one Context, but there can be at most one active at a time.
        Returns:
        Collection of all currently active Contexts
      • getActiveWeldAlterableContexts

        default Collection<WeldAlterableContext> getActiveWeldAlterableContexts()
        Returns an unmodifiable collection of all currently active Contexts that implement WeldAlterableContext. This is just a convenient method. Note that for each scope, there might be more than one Context, but there can be at most one active at a time. This method can therefore return an incomplete view of all active contexts as not every context implements WeldAlterableContext.
        Returns:
        Collection of all active contexts implementing WeldAlterableContext