protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
protected Object getReceiver(CreationalContext<X> creationalContext) { if (creationalContext != null) { if (creationalContext instanceof CreationalContextImpl<?>) { // Create child creational context so that a dependent observer may be destroyed after the observer method completes creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(declaringBean); } return ContextualInstance.get(declaringBean, beanManager, creationalContext); } // Conditional observer - no creational context is required return ContextualInstance.getIfExists(declaringBean, beanManager); }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public T getInstance() { T existingInstance = ContextualInstance.getIfExists(bean, manager); if (existingInstance != null) { return existingInstance; } WeldCreationalContext<T> creationalContext; WeldCreationalContext<?> previousCreationalContext = currentCreationalContext.get(); if (previousCreationalContext == null) { creationalContext = new CreationalContextImpl<T>(bean); } else { creationalContext = previousCreationalContext.getCreationalContext(bean); } currentCreationalContext.set(creationalContext); // Ensure that there is no injection point associated final ThreadLocalStackReference<InjectionPoint> stack = currentInjectionPoint.push(EmptyInjectionPoint.INSTANCE); try { return ContextualInstance.get(bean, manager, creationalContext); } finally { stack.pop(); if (previousCreationalContext == null) { currentCreationalContext.remove(); } else { currentCreationalContext.set(previousCreationalContext); } } }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public Object getReference(Bean<?> bean, Type requestedType, CreationalContext<?> creationalContext, boolean noProxy) { if (creationalContext instanceof CreationalContextImpl<?>) { creationalContext = ((CreationalContextImpl<?>) creationalContext).getCreationalContext(bean); } if (!noProxy && isProxyRequired(bean)) { if (creationalContext != null || ContextualInstance.getIfExists(bean, this) != null) { if (requestedType == null) { return clientProxyProvider.getClientProxy(bean); } else { return clientProxyProvider.getClientProxy(bean, requestedType); } } else { return null; } } else { return ContextualInstance.get(bean, this, creationalContext); } }
public T getInstance() { if (!Container.isSet(contextId)) { throw ContextLogger.LOG.contextualReferenceNotValidAfterShutdown(bean, contextId); } T existingInstance = ContextualInstance.getIfExists(bean, manager); if (existingInstance != null) { return existingInstance; } WeldCreationalContext<T> creationalContext; WeldCreationalContext<?> previousCreationalContext = currentCreationalContext.get(); if (previousCreationalContext == null) { creationalContext = new CreationalContextImpl<T>(bean); } else { creationalContext = previousCreationalContext.getCreationalContext(bean); } currentCreationalContext.set(creationalContext); // Ensure that there is no injection point associated final ThreadLocalStackReference<InjectionPoint> stack = currentInjectionPoint.push(EmptyInjectionPoint.INSTANCE); try { return ContextualInstance.get(bean, manager, creationalContext); } finally { stack.pop(); if (previousCreationalContext == null) { currentCreationalContext.remove(); } else { currentCreationalContext.set(previousCreationalContext); } } }
public T getInstance() { if (!Container.isSet(contextId)) { throw ContextLogger.LOG.contextualReferenceNotValidAfterShutdown(bean, contextId); } T existingInstance = ContextualInstance.getIfExists(bean, manager); if (existingInstance != null) { return existingInstance; } WeldCreationalContext<T> creationalContext; WeldCreationalContext<?> previousCreationalContext = currentCreationalContext.get(); if (previousCreationalContext == null) { creationalContext = new CreationalContextImpl<T>(bean); } else { creationalContext = previousCreationalContext.getCreationalContext(bean); } currentCreationalContext.set(creationalContext); // Ensure that there is no injection point associated final ThreadLocalStackReference<InjectionPoint> stack = currentInjectionPoint.push(EmptyInjectionPoint.INSTANCE); try { return ContextualInstance.get(bean, manager, creationalContext); } finally { stack.pop(); if (previousCreationalContext == null) { currentCreationalContext.remove(); } else { currentCreationalContext.set(previousCreationalContext); } } }
public void dispose(T instance) { if (disposalMethod != null) { // CreationalContext is only created if we need it to obtain the receiver // MethodInvocationStrategy takes care of creating CC for parameters, if needed if (disposalMethod.getAnnotated().isStatic()) { disposalMethod.invokeDisposeMethod(null, instance, null); } else { WeldCreationalContext<X> ctx = null; try { Object receiver = ContextualInstance.getIfExists(getDeclaringBean(), getBeanManager()); if (receiver == null) { ctx = getBeanManager().createCreationalContext(null); // Create child CC so that a dependent reciever may be destroyed after the disposer method completes receiver = ContextualInstance.get(getDeclaringBean(), getBeanManager(), ctx.getCreationalContext(getDeclaringBean())); } if (receiver != null) { disposalMethod.invokeDisposeMethod(receiver, instance, ctx); } } finally { if (ctx != null) { ctx.release(); } } } } }
public void dispose(T instance) { if (disposalMethod != null) { // CreationalContext is only created if we need it to obtain the receiver // MethodInvocationStrategy takes care of creating CC for parameters, if needed if (disposalMethod.getAnnotated().isStatic()) { disposalMethod.invokeDisposeMethod(null, instance, null); } else { WeldCreationalContext<X> ctx = null; try { Object receiver = ContextualInstance.getIfExists(getDeclaringBean(), getBeanManager()); if (receiver == null) { ctx = getBeanManager().createCreationalContext(null); // Create child CC so that a dependent reciever may be destroyed after the disposer method completes receiver = ContextualInstance.get(getDeclaringBean(), getBeanManager(), ctx.getCreationalContext(getDeclaringBean())); } if (receiver != null) { disposalMethod.invokeDisposeMethod(receiver, instance, ctx); } } finally { if (ctx != null) { ctx.release(); } } } } }
public void dispose(T instance) { if (disposalMethod != null) { // CreationalContext is only created if we need it to obtain the receiver // MethodInvocationStrategy takes care of creating CC for parameters, if needed if (disposalMethod.getAnnotated().isStatic()) { disposalMethod.invokeDisposeMethod(null, instance, null); } else { WeldCreationalContext<X> ctx = null; try { Object receiver = ContextualInstance.getIfExists(getDeclaringBean(), getBeanManager()); if (receiver == null) { ctx = getBeanManager().createCreationalContext(null); // Create child CC so that a dependent reciever may be destroyed after the disposer method completes receiver = ContextualInstance.get(getDeclaringBean(), getBeanManager(), ctx.getCreationalContext(getDeclaringBean())); } if (receiver != null) { disposalMethod.invokeDisposeMethod(receiver, instance, ctx); } } finally { if (ctx != null) { ctx.release(); } } } } }
public void dispose(T instance) { if (disposalMethod != null) { // CreationalContext is only created if we need it to obtain the receiver // MethodInvocationStrategy takes care of creating CC for parameters, if needed if (disposalMethod.getAnnotated().isStatic()) { disposalMethod.invokeDisposeMethod(null, instance, null); } else { WeldCreationalContext<X> ctx = null; try { Object receiver = ContextualInstance.getIfExists(getDeclaringBean(), getBeanManager()); if (receiver == null) { ctx = getBeanManager().createCreationalContext(null); // Create child CC so that a dependent reciever may be destroyed after the disposer method completes receiver = ContextualInstance.get(getDeclaringBean(), getBeanManager(), ctx.getCreationalContext(getDeclaringBean())); } if (receiver != null) { disposalMethod.invokeDisposeMethod(receiver, instance, ctx); } } finally { if (ctx != null) { ctx.release(); } } } } }
public void dispose(T instance) { if (disposalMethod != null) { // CreationalContext is only created if we need it to obtain the receiver // MethodInvocationStrategy takes care of creating CC for parameters, if needed if (disposalMethod.getAnnotated().isStatic()) { disposalMethod.invokeDisposeMethod(null, instance, null); } else { WeldCreationalContext<X> ctx = null; try { Object receiver = ContextualInstance.getIfExists(getDeclaringBean(), getBeanManager()); if (receiver == null) { ctx = getBeanManager().createCreationalContext(null); // Create child CC so that a dependent reciever may be destroyed after the disposer method completes receiver = ContextualInstance.get(getDeclaringBean(), getBeanManager(), ctx.getCreationalContext(getDeclaringBean())); } if (receiver != null) { disposalMethod.invokeDisposeMethod(receiver, instance, ctx); } } finally { if (ctx != null) { ctx.release(); } } } } }