Interface InjectionTargetFactory<T>

Type Parameters:
T - type on which this InjectionTarget operates

public interface InjectionTargetFactory<T>

An InjectionTargetFactory can create an InjectionTarget for a given bean.

The InjectionTargetFactory obtained from BeanManager.getInjectionTargetFactory(AnnotatedType) is capable of providing container created injection targets. This factory can be wrapped to add behavior to container created injection targets.

For example:

 BeanAttributes<MyBean> myBeanAttributes = beanManager.createBeanAttributes(myBeanAnnotatedType);
 beanManager.createBean(myBeanAttributes, MyBean.class, new InjectionTargetFactory() {

     public <T> InjectionTarget<T> createInjectionTarget(Bean<T> bean) {
         return new WrappingInjectionTarget<T>(
                 beanManager.getInjectionTargetFactory(myBeanAnnotatedType)
                         .createInjectionTarget(bean));
     }
 });
 

CDI Lite implementations are not required to provide support for InjectionTargetFactory.

Since:
1.1
Author:
Pete Muir, Antoine Sabot-Durand