Interface WeldManager

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

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

    Modifier and Type
    Method
    Description
    <T> jakarta.enterprise.inject.spi.AnnotatedType<T>
    Obtain an AnnotatedType that may be used to read the annotations of the given class or interface.
    createCreationalContext(jakarta.enterprise.context.spi.Contextual<T> contextual)
     
    <T> jakarta.enterprise.inject.spi.InjectionTarget<T>
    The injection target for the given EJB, or null if Weld was not given this descriptor in the deployment.
    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
    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>
    Returns an unmodifiable collection of all currently active Contexts.
    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.
    Collection<jakarta.enterprise.context.spi.Context>
    getContexts(Class<? extends Annotation> scopeType)
    Obtains all context objects, active and inactive, for the given scope.
    Get the EjbDescriptor for the given EJB name
    The ID of the manager, identical to the ID provided by the BDA
    getInjectionTargetFactory(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
     
    jakarta.enterprise.inject.spi.Bean<?>
    Returns the PassivationCapable bean with the given identifier.
    Returns an unmodifiable collection of all registered scopes, both built-in and custom.
    Get the services registered for this manager
    jakarta.enterprise.inject.Instance<Object>
     
    boolean
    isContextActive(Class<? extends Annotation> scopeType)
    Indicates whether there is an active context for a given scope.
     

    Methods inherited from interface jakarta.enterprise.inject.spi.BeanContainer

    createInstance, getBeans, getBeans, getContext, getEvent, getReference, isInterceptorBinding, isMatchingBean, isMatchingEvent, isNormalScope, isQualifier, isScope, isStereotype, resolve, resolveInterceptors, resolveObserverMethods

    Methods inherited from interface jakarta.enterprise.inject.spi.BeanManager

    areInterceptorBindingsEquivalent, areQualifiersEquivalent, createAnnotatedType, createBean, createBean, createBeanAttributes, createBeanAttributes, createInjectionPoint, createInjectionPoint, createInterceptionFactory, getExtension, getInjectableReference, getInterceptorBindingDefinition, getInterceptorBindingHashCode, getPassivationCapableBean, getProducerFactory, getProducerFactory, getQualifierHashCode, getStereotypeDefinition, isPassivatingScope, resolveDecorators, validate

    Methods inherited from interface jakarta.enterprise.inject.spi.el.ELAwareBeanManager

    getELResolver, wrapExpressionFactory
  • Method Details

    • 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:
    • 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)
      Returns the PassivationCapable bean with the given identifier. Note that when called during invocation of an AfterBeanDiscovery event observer, this method will only return beans discovered by the container before the AfterBeanDiscovery event is fired.
      Parameters:
      identifier - the identifier
      Returns:
      a Bean that implements PassivationCapable and has the given identifier, or a null value if there is no such bean
      Throws:
      IllegalStateException - if called during application initialization, before the AfterBeanDiscovery event is fired.
    • createInjectionTargetBuilder

      <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.
      Type Parameters:
      T - the type
      Parameters:
      type - the specified type
      Returns:
      a new WeldInjectionTargetBuilder instance for the specified type
    • 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:
    • 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
    • getContexts

      Collection<jakarta.enterprise.context.spi.Context> getContexts(Class<? extends Annotation> scopeType)
      Obtains all context objects, active and inactive, for the given scope.

      This feature is planned to be added into specification as part of this issue.

      Specified by:
      getContexts in interface jakarta.enterprise.inject.spi.BeanContainer
      Parameters:
      scopeType - the scope; must not be null
      Returns:
      immutable collection of context objects; never null, but may be empty