Interface Contextual<T>

All Known Subinterfaces:
Bean<T>, Decorator<T>, Interceptor<T>
All Known Implementing Classes:
AbstractBean, AbstractInterceptorBean, AbstractIntrospectedBean, AbstractSingletonBean, BeanAdapter, BeanWrapper, CauchoBean, DecoratorBean, DelegateProxyBean, EventBeanImpl, InjectionBean, InjectionPointBean, InjectionPointStandardBean, InstanceBeanImpl, InterceptorBean, InterceptorRuntimeBean, InterceptorSelfBean, ManagedBeanImpl, ManagedSingletonBean, NewBean, ProducesFieldBean, ProducesMethodBean, SessionBeanImpl, SessionRegistrationBean, SingletonBean, StatefulBeanImpl, StatelessBeanImpl, XmlBean, XmlManagedBeanImpl

public interface Contextual<T>

Contextual creates and destroys instances of a given type. In particular, the Bean interface extends Contextual. Applications will not use Contextual, because its internal SPI, called by the javax.enterprise.inject.spi.Manager during bean creation.

Method Summary
 T create(CreationalContext<T> creationalContext)
          Creates a new instance for the Contextual's type.
 void destroy(T instance, CreationalContext<T> creationalContext)
          Destroys an instance for the Contextual's type.

Method Detail


T create(CreationalContext<T> creationalContext)
Creates a new instance for the Contextual's type. If the instance already exists in the CreationalContext, create will return it instead of creating a new instance.
  1. create an instance of the bean
  2. create interceptor and decorator stacks
  3. inject dependencies
  4. set any XML-configured values
  5. call @PostConstruct

creationalContext - the creation context used to support circular references.
the new instance


void destroy(T instance,
             CreationalContext<T> creationalContext)
Destroys an instance for the Contextual's type.
  1. Call any @Disposal method
  2. Call @PreDestroy methods
  3. Destroy dependent objects

instance - the instance to destroy