T
- type inherited from Instance
. Always Object for CDIpublic abstract class CDI<T> extends java.lang.Object implements Instance<T>
CDI implements Instance
and therefore might be used to perform programmatic lookup.
If no qualifier is passed to Instance.select(java.lang.annotation.Annotation...)
method, the @Default qualifier is assumed.
Modifier and Type | Field and Description |
---|---|
protected static CDIProvider |
configuredProvider |
protected static java.util.Set<CDIProvider> |
discoveredProviders |
private static java.lang.Object |
lock |
Constructor and Description |
---|
CDI() |
Modifier and Type | Method and Description |
---|---|
static CDI<java.lang.Object> |
current()
Get the CDI instance that provides access to the current container.
|
private static void |
findAllProviders() |
abstract BeanManager |
getBeanManager()
Get the CDI BeanManager for the current context
|
private static CDIProvider |
getCDIProvider()
Obtain the
CDIProvider the user set with setCDIProvider(CDIProvider) , or if it wasn't set, use the
serviceloader the retrieve the CDIProvider with the highest priority. |
static void |
setCDIProvider(CDIProvider provider)
Set the
CDIProvider to use. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
destroy, isAmbiguous, isResolvable, isUnsatisfied, select, select, select, stream
private static final java.lang.Object lock
protected static volatile java.util.Set<CDIProvider> discoveredProviders
protected static volatile CDIProvider configuredProvider
public static CDI<java.lang.Object> current()
Get the CDI instance that provides access to the current container.
If there are no providers available, an IllegalStateException
is thrown, otherwise the first provider which can
access the container is used.
java.lang.IllegalStateException
- if no CDIProvider
is availableprivate static CDIProvider getCDIProvider()
CDIProvider
the user set with setCDIProvider(CDIProvider)
, or if it wasn't set, use the
serviceloader the retrieve the CDIProvider
with the highest priority.CDIProvider
set by user or retrieved by serviceloaderpublic static void setCDIProvider(CDIProvider provider)
Set the CDIProvider
to use.
If a CDIProvider
is set using this method, any provider specified as a service provider will not be used.
provider
- the provider to usejava.lang.IllegalStateException
- if the CDIProvider
is already setprivate static void findAllProviders()
public abstract BeanManager getBeanManager()