javax.enterprise.inject.spi.InjectionTargetFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cdi-api Show documentation
Show all versions of cdi-api Show documentation
APIs for CDI (Contexts and Dependency Injection for Java EE)
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(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 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);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy