Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package javax.enterprise.inject.spi;

An InjectionTargetFactory can create an InjectionTarget for a given bean.

The InjectionTargetFactory obtained from BeanManager.getInjectionTargetFactory(javax.enterprise.inject.spi.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));
     }
 });
 

Author(s):
Pete Muir
Since:
1.1
public interface InjectionTargetFactory<T> {

    
Create a new injection target for a bean.

Parameters:
bean the bean to create the injection target for, or null if creating a non-contextual object
Returns:
the injection target
    public InjectionTarget<T> createInjectionTarget(Bean<T> bean);
New to GrepCode? Check out our FAQ X