Interface ArcContainer

  • All Known Implementing Classes:
    ArcContainerImpl

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

      • getActiveContext

        InjectableContext getActiveContext​(Class<? extends Annotation> scopeType)
        Unlike BeanManager.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
      • 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​(javax.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:
        InjectableBean.getName()
      • instanceSupplier

        <T> Supplier<InstanceHandle<T>> instanceSupplier​(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. Note that if there are multiple sub classes of the given type this will return the exact match. This means that this can be used to directly instantiate superclasses of other beans without causing problems. see https://github.com/quarkusio/quarkus/issues/3369
        Type Parameters:
        T -
        Parameters:
        type -
        qualifiers -
        Returns:
      • 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​(javax.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
      • 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
      • requestContext

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

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

        ExecutorService getExecutorService()
        Returns:
        the default executor service