javax.enterprise.inject.spi
Class CDI<T>

java.lang.Object
  extended by javax.enterprise.inject.spi.CDI<T>
All Implemented Interfaces:
Iterable<T>, Instance<T>, javax.inject.Provider<T>

public abstract class CDI<T>
extends Object
implements Instance<T>

Provides access to the current container.

Author:
Pete Muir

Field Summary
protected static CDIProvider configuredProvider
           
protected static Set<CDIProvider> discoveredProviders
           
 
Constructor Summary
CDI()
           
 
Method Summary
static CDI<Object> current()
           Get the CDI instance that provides access to the current container.
abstract  BeanManager getBeanManager()
          Get the CDI BeanManager for the current context
static void setCDIProvider(CDIProvider provider)
           Set the CDIProvider to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.enterprise.inject.Instance
destroy, isAmbiguous, isUnsatisfied, select, select, select
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface javax.inject.Provider
get
 

Field Detail

discoveredProviders

protected static volatile Set<CDIProvider> discoveredProviders

configuredProvider

protected static volatile CDIProvider configuredProvider
Constructor Detail

CDI

public CDI()
Method Detail

current

public static CDI<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.

Throws:
IllegalStateException - if no CDI provider is available

setCDIProvider

public 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.

Parameters:
provider - the provider to use
Throws:
IllegalStateException - if the CDIProvider is already set

getBeanManager

public abstract BeanManager getBeanManager()
Get the CDI BeanManager for the current context

Returns:


Copyright © 2008-2012 JBoss by Red Hat, Inc.. All Rights Reserved.