Package io.quarkus.arc
Interface ArcContainer
- All Known Implementing Classes:
ArcContainerImpl
public interface ArcContainer
Represents a container instance.
- Author:
- Martin Kouba
-
Method Summary
Modifier and TypeMethodDescription<T> InjectableBean<T>
<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.jakarta.enterprise.inject.spi.BeanManager
NOTE: Not all methods are supported!getActiveContext
(Class<? extends Annotation> scopeType) UnlikeBeanContainer.getContext(Class)
this method does not throwContextNotActiveException
if there is no active context for the given scope.getContexts
(Class<? extends Annotation> scopeType) Set<Class<? extends Annotation>>
<T> InstanceHandle<T>
instance
(InjectableBean<T> bean) <T> InstanceHandle<T>
instance
(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers) Never returns null.<T> InstanceHandle<T>
instance
(Class<T> type, Annotation... qualifiers) Never returns null.<X> InstanceHandle<X>
instance
(Type type, Annotation... qualifiers) Never returns null.<T> InstanceHandle<T>
Never returns null.boolean
Returns true if Arc container is running.<T> List<InstanceHandle<T>>
listAll
(jakarta.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers) List all beans matching the required type and qualifiers.<T> List<InstanceHandle<T>>
listAll
(Class<T> type, Annotation... qualifiers) List all beans matching the required type and qualifiers.<X> List<InstanceHandle<X>>
listAll
(Type type, Annotation... qualifiers) Note that ambiguous names are detected at build time.This method never throwsContextNotActiveException
.<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 theInstance.destroy(Object)
method invoked upon the same injectable instance or withInstanceHandle.destroy()
.<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 theInstance.destroy(Object)
method invoked upon the same injectable instance or withInstanceHandle.destroy()
.boolean
Indicates whether container runs in strict compatibility mode.
-
Method Details
-
getActiveContext
UnlikeBeanContainer.getContext(Class)
this method does not throwContextNotActiveException
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
- Parameters:
scopeType
-- Returns:
- the matching context objects, never null
-
getScopes
Set<Class<? extends Annotation>> getScopes()- Returns:
- the set of all supported scopes
-
instance
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
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
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
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
- Parameters:
bean
-- Returns:
- a new bean instance handle
-
select
Instances of dependent scoped beans obtained with the returned injectable instance must be explicitly destroyed, either via theInstance.destroy(Object)
method invoked upon the same injectable instance or withInstanceHandle.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 theInstance.destroy(Object)
method invoked upon the same injectable instance or withInstanceHandle.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
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
- 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
- Parameters:
beanIdentifier
-- Returns:
- an injectable bean or null
- See Also:
-
namedBean
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 ornull
if no bean matches.- Parameters:
name
-- Returns:
- an injectable bean with the given name or null
- See Also:
-
requestContext
ManagedContext requestContext()This method never throwsContextNotActiveException
.- 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.
-