@Override public T create(CreationalContext<T> context) { CreationalContextImpl<T> contextImpl; if(!CreationalContextImpl.class.isInstance(context)) { contextImpl = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(context, this); } else { contextImpl = CreationalContextImpl.class.cast(context); } T t; Bean<T> oldBean = contextImpl.putBean(this); try { t = bean.create(contextImpl); } finally { contextImpl.putBean(oldBean); } if (getScope().equals(Dependent.class)) { contextImpl.addDependent(this, t); } return t; }
@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); }
@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); }
creationalContextImpl = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, instanceBean);
public T create(CreationalContext<T> creationalContext) { if (!(creationalContext instanceof CreationalContextImpl)) { creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, this); } CreationalContextImpl<T> creationalContextImpl = (CreationalContextImpl<T>)creationalContext; Bean<T> oldBean = creationalContextImpl.putBean(this); Contextual<T> oldContextual = creationalContextImpl.putContextual(this); // otherwise BeanMetaData is broken try { return super.create(creationalContext); } finally { creationalContextImpl.putBean(oldBean); creationalContextImpl.putContextual(oldContextual); } }
creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, this);
creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, bean);
creationalContext = webBeansContext.getCreationalContextFactory().getCreationalContext(cdiEjbBean); } else { creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, cdiEjbBean);
creationalContext = webBeansContext.getCreationalContextFactory().getCreationalContext(cdiEjbBean); } else { creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(creationalContext, cdiEjbBean);
ownerCreationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(ownerCreationalContext, injectionPoint.getBean());