@Override public T produce(CreationalContext<T> ctx) { T result = super.produce(ctx); if (result instanceof ProxyObject) { // if decorators are applied, use SessionBeanViewMethodHandler ProxyObject proxy = (ProxyObject) result; proxy.setHandler(new SessionBeanViewMethodHandler(bean.getTypes(), (CombinedInterceptorAndDecoratorStackMethodHandler) proxy.getHandler())); } return result; }
@Override public T produce(CreationalContext<T> ctx) { T result = super.produce(ctx); if (result instanceof ProxyObject) { // if decorators are applied, use SessionBeanViewMethodHandler ProxyObject proxy = (ProxyObject) result; proxy.weld_setHandler(new SessionBeanViewMethodHandler(bean.getTypes(), (CombinedInterceptorAndDecoratorStackMethodHandler) proxy.weld_getHandler())); } return result; }
/** * Produces a factory for a specific bean implementation. * * @param proxiedBeanType the actual enterprise bean */ public EnterpriseProxyFactory(Class<T> proxiedBeanType, SessionBean<T> bean) { super(bean.getBeanManager().getContextId(), proxiedBeanType, ImmutableSet.<Type> builder().addAll(bean.getTypes()) .addAll(bean.getEjbDescriptor().getRemoteBusinessInterfacesAsClasses()).build(), bean); }
@Override public void initializeAfterBeanDiscovery(EnhancedAnnotatedType<T> annotatedType) { initializeInterceptionModel(annotatedType); List<Decorator<?>> decorators = beanManager.resolveDecorators(getBean().getTypes(), getBean().getQualifiers()); if (!decorators.isEmpty()) { Instantiator<T> instantiator = getInstantiator(); EnhancedAnnotatedType<T> implementationClass = SessionBeans.getEjbImplementationClass(getBean()); instantiator = SubclassedComponentInstantiator.forInterceptedDecoratedBean(implementationClass, getBean(), (AbstractInstantiator<T>) instantiator, beanManager); instantiator = new SubclassDecoratorApplyingInstantiator<T>(getBeanManager().getContextId(), instantiator, getBean(), decorators, implementationClass.getJavaClass()); setInstantiator(instantiator); } /* * We only take care of @AroundConstructor interception. The EJB container deals with the other types of interception. */ setupConstructorInterceptionInstantiator(beanManager.getInterceptorModelRegistry().get(getType())); }
@Override public void initializeAfterBeanDiscovery(EnhancedAnnotatedType<T> annotatedType) { initializeInterceptionModel(annotatedType); List<Decorator<?>> decorators = beanManager.resolveDecorators(getBean().getTypes(), getBean().getQualifiers()); if (!decorators.isEmpty()) { Instantiator<T> instantiator = getInstantiator(); EnhancedAnnotatedType<T> implementationClass = Beans.getEjbImplementationClass(getBean()); instantiator = SubclassedComponentInstantiator.forInterceptedDecoratedBean(implementationClass, getBean(), (AbstractInstantiator<T>) instantiator, beanManager); instantiator = new SubclassDecoratorApplyingInstantiator<T>(getBeanManager().getContextId(), instantiator, getBean(), decorators, implementationClass.getJavaClass()); setInstantiator(instantiator); } /* * We only take care of @AroundConstructor interception. The EJB container deals with the other types of interception. */ setupConstructorInterceptionInstantiator(beanManager.getInterceptorModelRegistry().get(getType())); }