Search in sources :

Example 1 with InjectionTargetBean

use of org.apache.webbeans.component.InjectionTargetBean in project tomee by apache.

the class BeanContext method inject.

@SuppressWarnings("unchecked")
public <T> void inject(final T instance, CreationalContext<T> ctx) {
    final WebBeansContext webBeansContext = getWebBeansContext();
    if (webBeansContext == null) {
        return;
    }
    InjectionTargetBean<T> beanDefinition = get(CdiEjbBean.class);
    if (beanDefinition == null) {
        beanDefinition = InjectionTargetBean.class.cast(createConstructorInjectionBean(webBeansContext));
    }
    if (!(ctx instanceof CreationalContextImpl)) {
        ctx = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(ctx, beanDefinition);
    }
    beanDefinition.getInjectionTarget().inject(instance, ctx);
}
Also used : WebBeansContext(org.apache.webbeans.config.WebBeansContext) CreationalContextImpl(org.apache.webbeans.context.creational.CreationalContextImpl) InjectionTargetBean(org.apache.webbeans.component.InjectionTargetBean)

Aggregations

InjectionTargetBean (org.apache.webbeans.component.InjectionTargetBean)1 WebBeansContext (org.apache.webbeans.config.WebBeansContext)1 CreationalContextImpl (org.apache.webbeans.context.creational.CreationalContextImpl)1