Package io.quarkus.arc.impl
Class ArcContainerImpl
- java.lang.Object
-
- io.quarkus.arc.impl.ArcContainerImpl
-
- All Implemented Interfaces:
ArcContainer
public class ArcContainerImpl extends Object implements ArcContainer
-
-
Constructor Summary
Constructors Constructor Description ArcContainerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> InjectableBean<T>bean(String beanIdentifier)javax.enterprise.inject.spi.BeanManagerbeanManager()NOTE: Not all methods are supported!InjectableContextgetActiveContext(Class<? extends Annotation> scopeType)UnlikeBeanManager.getContext(Class)this method does not throwContextNotActiveExceptionif there is no active context for the given scope.List<InjectableBean<?>>getBeans()Collection<InjectableContext>getContexts(Class<? extends Annotation> scopeType)ExecutorServicegetExecutorService()List<InjectableInterceptor<?>>getInterceptors()List<InjectableObserverMethod<?>>getObservers()List<RemovedBean>getRemovedBeans()Set<Class<? extends Annotation>>getScopes()voidinit()static ArcContainerImplinstance()<T> InstanceHandle<T>instance(InjectableBean<T> bean)<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>instance(String name)Never returns null.<T> InstanceHandle<T>instance(javax.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)Never returns null.<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.booleanisRunning()Returns true if Arc container is running.static voidmockObservers(String beanIdentifier, boolean mock)voidmockObserversFor(Class<?> beanClass, boolean mock)ManagedContextrequestContext()This method never throwsContextNotActiveException.<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().<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 theInstance.destroy(Object)method invoked upon the same injectable instance or withInstanceHandle.destroy().voidsetExecutor(ExecutorService executor)voidshutdown()StringtoString()
-
-
-
Method Detail
-
init
public void init()
-
getActiveContext
public InjectableContext getActiveContext(Class<? extends Annotation> scopeType)
Description copied from interface:ArcContainerUnlikeBeanManager.getContext(Class)this method does not throwContextNotActiveExceptionif there is no active context for the given scope.- Specified by:
getActiveContextin interfaceArcContainer- Returns:
- the active context or null
-
getContexts
public Collection<InjectableContext> getContexts(Class<? extends Annotation> scopeType)
- Specified by:
getContextsin interfaceArcContainer- Returns:
- the matching context objects, never null
-
getScopes
public Set<Class<? extends Annotation>> getScopes()
- Specified by:
getScopesin interfaceArcContainer- Returns:
- the set of all supported scopes
-
instance
public <T> InstanceHandle<T> instance(Class<T> type, Annotation... qualifiers)
Description copied from interface:ArcContainerNever returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.- Specified by:
instancein interfaceArcContainer- Returns:
- a new instance handle
-
instance
public <T> InstanceHandle<T> instance(javax.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
Description copied from interface:ArcContainerNever returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.- Specified by:
instancein interfaceArcContainer- Returns:
- a new instance handle
-
instance
public <X> InstanceHandle<X> instance(Type type, Annotation... qualifiers)
Description copied from interface:ArcContainerNever returns null. However, the handle is empty if no bean matches/multiple beans match the specified type and qualifiers.- Specified by:
instancein interfaceArcContainer- Returns:
- a new instance handle
-
instanceSupplier
public <T> Supplier<InstanceHandle<T>> instanceSupplier(Class<T> type, Annotation... qualifiers)
Description copied from interface:ArcContainerReturns 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- Specified by:
instanceSupplierin interfaceArcContainer- Returns:
-
instance
public <T> InstanceHandle<T> instance(InjectableBean<T> bean)
- Specified by:
instancein interfaceArcContainer- Returns:
- a new bean instance handle
-
select
public <T> InjectableInstance<T> select(Class<T> type, Annotation... qualifiers)
Description copied from interface:ArcContainerInstances 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.- Specified by:
selectin interfaceArcContainer- Returns:
- a new injectable instance that could be used for programmatic lookup
-
select
public <T> InjectableInstance<T> select(javax.enterprise.util.TypeLiteral<T> type, Annotation... qualifiers)
Description copied from interface:ArcContainerInstances 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.- Specified by:
selectin interfaceArcContainer- Returns:
- a new injectable instance that could be used for programmatic lookup
-
isRunning
public boolean isRunning()
Description copied from interface:ArcContainerReturns true if Arc container is running. This can be used as a quick check to determine CDI availability in Quarkus.- Specified by:
isRunningin interfaceArcContainer- Returns:
- true is
ArcContaineris running, false otherwise
-
bean
public <T> InjectableBean<T> bean(String beanIdentifier)
- Specified by:
beanin interfaceArcContainer- Returns:
- an injectable bean or null
- See Also:
InjectableBean.getIdentifier()
-
instance
public <T> InstanceHandle<T> instance(String name)
Description copied from interface:ArcContainerNever returns null. However, the handle is empty if no bean matches/multiple beans match the specified name.- Specified by:
instancein interfaceArcContainer- Returns:
- a new instance handle
- See Also:
InjectableBean.getName()
-
requestContext
public ManagedContext requestContext()
Description copied from interface:ArcContainerThis method never throwsContextNotActiveException.- Specified by:
requestContextin interfaceArcContainer- Returns:
- the built-in context for
RequestScoped
-
beanManager
public javax.enterprise.inject.spi.BeanManager beanManager()
Description copied from interface:ArcContainerNOTE: Not all methods are supported!- Specified by:
beanManagerin interfaceArcContainer- Returns:
- the bean manager
-
getExecutorService
public ExecutorService getExecutorService()
- Specified by:
getExecutorServicein interfaceArcContainer- Returns:
- the default executor service
-
setExecutor
public void setExecutor(ExecutorService executor)
-
shutdown
public void shutdown()
-
getBeans
public List<InjectableBean<?>> getBeans()
-
getRemovedBeans
public List<RemovedBean> getRemovedBeans()
-
getInterceptors
public List<InjectableInterceptor<?>> getInterceptors()
-
getObservers
public List<InjectableObserverMethod<?>> getObservers()
-
mockObservers
public static void mockObservers(String beanIdentifier, boolean mock)
-
mockObserversFor
public void mockObserversFor(Class<?> beanClass, boolean mock)
-
instance
public static ArcContainerImpl instance()
-
-