javax.enterprise.inject.spi.InjectionTargetFactory Maven / Gradle / Ivy
package javax.enterprise.inject.spi;
/**
*
* An {@link InjectionTargetFactory} can create an {@link InjectionTarget} for a given bean.
*
*
*
* The {@link InjectionTargetFactory} obtained from {@link BeanManager#getInjectionTargetFactory()} 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 Pete Muir
* @since 1.1
*
*/
public interface InjectionTargetFactory {
/**
* Create a new injection target for a bean.
*
* @param bean the bean to create the injection target for, or null if creating a non-contextual object
* @return the injection target
*/
public InjectionTarget createInjectionTarget(Bean bean);
}