Class ArcContainerImpl

java.lang.Object
io.quarkus.arc.impl.ArcContainerImpl
All Implemented Interfaces:
ArcContainer

public class ArcContainerImpl extends Object implements ArcContainer
  • Constructor Details

    • ArcContainerImpl

      public ArcContainerImpl(CurrentContextFactory currentContextFactory, boolean strictMode, boolean testMode)
  • Method Details

    • init

      public void init()
    • getActiveContext

      public InjectableContext getActiveContext(Class<? extends Annotation> scopeType)
      Description copied from interface: ArcContainer
      Unlike BeanContainer.getContext(Class) this method does not throw ContextNotActiveException if there is no active context for the given scope.
      Specified by:
      getActiveContext in interface ArcContainer
      Parameters:
      scopeType -
      Returns:
      the active context or null
    • getContexts

      public List<InjectableContext> getContexts(Class<? extends Annotation> scopeType)
      Specified by:
      getContexts in interface ArcContainer
      Parameters:
      scopeType -
      Returns:
      immutable list of the matching context objects, never null
    • getScopes

      public Set<Class<? extends Annotation>> getScopes()
      Specified by:
      getScopes in interface ArcContainer
      Returns:
      the set of all supported scopes
    • instance

      public <T> InstanceHandle<T> instance(Class<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Specified by:
      instance in interface ArcContainer
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
    • instance

      public <T> InstanceHandle<T> instance(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Specified by:
      instance in interface ArcContainer
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
    • instance

      public <X> InstanceHandle<X> instance(Type type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Specified by:
      instance in interface ArcContainer
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
    • beanInstanceSupplier

      public <T> Supplier<InstanceHandle<T>> beanInstanceSupplier(Class<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Returns a supplier that can be used to create new instances, or null if no matching bean can be found.
      Specified by:
      beanInstanceSupplier in interface ArcContainer
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
    • instance

      public <T> InstanceHandle<T> instance(InjectableBean<T> bean)
      Specified by:
      instance in interface ArcContainer
      Parameters:
      bean -
      Returns:
      a new bean instance handle
    • select

      public <T> InjectableInstance<T> select(Class<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Instances of dependent scoped beans obtained with the returned injectable instance must be explicitly destroyed, either via the Instance.destroy(Object) method invoked upon the same injectable instance or with InstanceHandle.destroy(). If no qualifier is passed, the @Default qualifier is assumed.
      Specified by:
      select in interface ArcContainer
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      a new injectable instance that could be used for programmatic lookup
    • select

      public <T> InjectableInstance<T> select(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      Instances of dependent scoped beans obtained with the returned injectable instance must be explicitly destroyed, either via the Instance.destroy(Object) method invoked upon the same injectable instance or with InstanceHandle.destroy(). If no qualifier is passed, the @Default qualifier is assumed.
      Specified by:
      select in interface ArcContainer
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      a new injectable instance that could be used for programmatic lookup
    • listAll

      public <T> List<InstanceHandle<T>> listAll(Class<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      List all beans matching the required type and qualifiers.

      Instances of dependent scoped beans should be explicitly destroyed with InstanceHandle.destroy().

      The list is sorted by InjectableBean.getPriority(). Higher priority goes first.

      Specified by:
      listAll in interface ArcContainer
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      the list of handles for the disambiguated beans
      See Also:
    • listAll

      public <T> List<InstanceHandle<T>> listAll(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      Description copied from interface: ArcContainer
      List all beans matching the required type and qualifiers.

      Instances of dependent scoped beans should be explicitly destroyed with InstanceHandle.destroy().

      The list of is sorted by InjectableBean.getPriority(). Higher priority goes first.

      Specified by:
      listAll in interface ArcContainer
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      the list of handles for the disambiguated beans
      See Also:
    • listAll

      public <X> List<InstanceHandle<X>> listAll(Type type, Annotation... qualifiers)
      Specified by:
      listAll in interface ArcContainer
      Type Parameters:
      X -
      Parameters:
      type -
      qualifiers -
      Returns:
      the list of handles for the disambiguated beans
      See Also:
    • isRunning

      public boolean isRunning()
      Description copied from interface: ArcContainer
      Returns true if Arc container is running. This can be used as a quick check to determine CDI availability in Quarkus.
      Specified by:
      isRunning in interface ArcContainer
      Returns:
      true if ArcContainer is running, false otherwise
    • bean

      public <T> InjectableBean<T> bean(String beanIdentifier)
      Specified by:
      bean in interface ArcContainer
      Parameters:
      beanIdentifier -
      Returns:
      an injectable bean or null
      See Also:
    • namedBean

      public InjectableBean<?> namedBean(String name)
      Description copied from interface: ArcContainer
      Note that ambiguous names are detected at build time. Therefore, unlike
      invalid @link
      {@link jakarta.enterprise.inject.spi.BeanManager.getBeans(String)
      } this method either returns a resolved bean or null if no bean matches.
      Specified by:
      namedBean in interface ArcContainer
      Parameters:
      name -
      Returns:
      an injectable bean with the given name or null
      See Also:
    • instance

      public <T> InstanceHandle<T> instance(String name)
      Description copied from interface: ArcContainer
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified name.
      Specified by:
      instance in interface ArcContainer
      Parameters:
      name -
      Returns:
      a new instance handle
      See Also:
    • requestContext

      public ManagedContext requestContext()
      Description copied from interface: ArcContainer
      This method never throws ContextNotActiveException.
      Specified by:
      requestContext in interface ArcContainer
      Returns:
      the built-in context for RequestScoped
    • sessionContext

      public ManagedContext sessionContext()
      Description copied from interface: ArcContainer
      This method never throws ContextNotActiveException.
      Specified by:
      sessionContext in interface ArcContainer
      Returns:
      the built-in context for SessionScoped
    • beanManager

      public jakarta.enterprise.inject.spi.BeanManager beanManager()
      Description copied from interface: ArcContainer
      NOTE: Not all methods are supported!
      Specified by:
      beanManager in interface ArcContainer
      Returns:
      the bean manager
    • getExecutorService

      public ExecutorService getExecutorService()
      Specified by:
      getExecutorService in interface ArcContainer
      Returns:
      the default executor service
    • setExecutor

      public void setExecutor(ExecutorService executor)
    • getCurrentContextFactory

      public CurrentContextFactory getCurrentContextFactory()
      Specified by:
      getCurrentContextFactory in interface ArcContainer
      Returns:
      the factory
      See Also:
    • strictCompatibility

      public boolean strictCompatibility()
      Description copied from interface: ArcContainer
      Indicates whether container runs in strict compatibility mode. Default value is false.
      Specified by:
      strictCompatibility in interface ArcContainer
      Returns:
      true is strict mode is enabled, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • shutdown

      public void shutdown()
    • getBeans

      public List<InjectableBean<?>> getBeans()
    • getRemovedBeans

      public List<RemovedBean> getRemovedBeans()
    • getInterceptors

      public List<InjectableInterceptor<?>> getInterceptors()
    • getDecorators

      public List<InjectableDecorator<?>> getDecorators()
    • getObservers

      public List<InjectableObserverMethod<?>> getObservers()
    • resolveObserverMethods

      public <T> List<InjectableObserverMethod<? super T>> resolveObserverMethods(Type eventType, Annotation... eventQualifiers)
      Specified by:
      resolveObserverMethods in interface ArcContainer
      Parameters:
      eventType -
      eventQualifiers -
      Returns:
      an ordered list of observer methods
    • mockObservers

      public static void mockObservers(String beanIdentifier, boolean mock)
    • mockObserversFor

      public void mockObserversFor(Class<?> beanClass, boolean mock)
    • instance

      public static ArcContainerImpl instance()