Interface ArcContainer

All Known Implementing Classes:
ArcContainerImpl

public interface ArcContainer
Represents a container instance.
Author:
Martin Kouba
  • Method Details

    • getActiveContext

      InjectableContext getActiveContext(Class<? extends Annotation> scopeType)
      Unlike BeanContainer.getContext(Class) this method does not throw ContextNotActiveException if there is no active context for the given scope.
      Parameters:
      scopeType -
      Returns:
      the active context or null
      Throws:
      IllegalArgumentException - if there is more than one active context for the given scope
    • getContexts

      List<InjectableContext> getContexts(Class<? extends Annotation> scopeType)
      Parameters:
      scopeType -
      Returns:
      the matching context objects, never null
    • getScopes

      Set<Class<? extends Annotation>> getScopes()
      Returns:
      the set of all supported scopes
    • instance

      <T> InstanceHandle<T> instance(Class<T> type, Annotation... qualifiers)
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
      Throws:
      IllegalArgumentException - if an instance of an annotation that is not a qualifier type is given
    • instance

      <T> InstanceHandle<T> instance(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
      Throws:
      IllegalArgumentException - if an instance of an annotation that is not a qualifier type is given
    • instance

      <X> InstanceHandle<X> instance(Type type, Annotation... qualifiers)
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.
      Parameters:
      type -
      qualifiers -
      Returns:
      a new instance handle
      Throws:
      IllegalArgumentException - if an instance of an annotation that is not a qualifier type is given
    • instance

      <T> InstanceHandle<T> instance(String name)
      Never returns null. However, the handle is empty if no bean matches/multiple beans match the specified name.
      Parameters:
      name -
      Returns:
      a new instance handle
      See Also:
    • beanInstanceSupplier

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

      <T> InstanceHandle<T> instance(InjectableBean<T> bean)
      Parameters:
      bean -
      Returns:
      a new bean instance handle
    • select

      <T> InjectableInstance<T> select(Class<T> type, Annotation... qualifiers)
      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.
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      a new injectable instance that could be used for programmatic lookup
    • select

      <T> InjectableInstance<T> select(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      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.
      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      a new injectable instance that could be used for programmatic lookup
    • listAll

      <T> List<InstanceHandle<T>> listAll(Class<T> type, Annotation... qualifiers)
      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.

      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      the list of handles for the disambiguated beans
      See Also:
    • listAll

      <T> List<InstanceHandle<T>> listAll(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
      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.

      Type Parameters:
      T -
      Parameters:
      type -
      qualifiers -
      Returns:
      the list of handles for the disambiguated beans
      See Also:
    • listAll

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

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

      <T> InjectableBean<T> bean(String beanIdentifier)
      Parameters:
      beanIdentifier -
      Returns:
      an injectable bean or null
      See Also:
    • namedBean

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

      ManagedContext requestContext()
      This method never throws ContextNotActiveException.
      Returns:
      the built-in context for RequestScoped
    • beanManager

      jakarta.enterprise.inject.spi.BeanManager beanManager()
      NOTE: Not all methods are supported!
      Returns:
      the bean manager
    • getExecutorService

      ExecutorService getExecutorService()
      Returns:
      the default executor service
    • getCurrentContextFactory

      CurrentContextFactory getCurrentContextFactory()
      Returns:
      the factory
      See Also:
    • strictCompatibility

      boolean strictCompatibility()
      Indicates whether container runs in strict compatibility mode. Default value is false.
      Returns:
      true is strict mode is enabled, false otherwise.