/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (bean instanceof SessionBean<?>) { EnhancedAnnotatedType<T> implementationClass = Beans.getEjbImplementationClass((SessionBean<T>) bean); AbstractInstantiator<T> instantiator = null; if (type.equals(implementationClass)) { instantiator = new DefaultInstantiator<T>(type, bean, beanManager); } else { // Session bean subclassed by the EJB container instantiator = SubclassedComponentInstantiator.forSubclassedEjb(type, implementationClass, bean, beanManager); } injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } else { throw new IllegalArgumentException("Cannot create SessionBeanInjectionTarget for " + bean); } }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (bean instanceof SessionBean<?>) { EnhancedAnnotatedType<T> implementationClass = SessionBeans.getEjbImplementationClass((SessionBean<T>) bean); AbstractInstantiator<T> instantiator = null; if (type.equals(implementationClass)) { instantiator = new DefaultInstantiator<T>(type, bean, beanManager); } else { // Session bean subclassed by the EJB container instantiator = SubclassedComponentInstantiator.forSubclassedEjb(type, implementationClass, bean, beanManager); } injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } else { throw new IllegalArgumentException("Cannot create SessionBeanInjectionTarget for " + bean); } }
/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
protected InjectionTarget<T> createMessageDrivenInjectionTarget(InternalEjbDescriptor<T> descriptor) { EnhancedAnnotatedType<T> implementationClass = Beans.getEjbImplementationClass(descriptor, manager, type); AbstractInstantiator<T> instantiator = null; if (type.equals(implementationClass)) { instantiator = new DefaultInstantiator<T>(type, null, manager); } else { // Session bean subclassed by the EJB container instantiator = SubclassedComponentInstantiator.forSubclassedEjb(type, implementationClass, null, manager); } return prepareInjectionTarget(BasicInjectionTarget.createDefault(type, null, manager, instantiator)); }
/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
@Override public <T> BasicInjectionTarget<T> createMessageDrivenInjectionTarget(EnhancedAnnotatedType<T> type, EjbDescriptor<T> d, BeanManagerImpl manager) { InternalEjbDescriptor<T> descriptor = InternalEjbDescriptor.of(d); EnhancedAnnotatedType<T> implementationClass = SessionBeans.getEjbImplementationClass(descriptor, manager, type); Instantiator<T> instantiator = null; if (type.equals(implementationClass)) { instantiator = new DefaultInstantiator<T>(type, null, manager); } else { // Session bean subclassed by the EJB container instantiator = SubclassedComponentInstantiator.forSubclassedEjb(type, implementationClass, null, manager); } InterceptionModel interceptionModel = manager.getInterceptorModelRegistry().get(type.slim()); if (interceptionModel != null) { if (interceptionModel.hasExternalNonConstructorInterceptors()) { instantiator = SubclassedComponentInstantiator .forInterceptedDecoratedBean(implementationClass, null, (AbstractInstantiator<T>) instantiator, manager); instantiator = new InterceptorApplyingInstantiator<>(instantiator, interceptionModel, type.slim()); } if (interceptionModel.hasExternalConstructorInterceptors()) { instantiator = new ConstructorInterceptionInstantiator<>(instantiator, interceptionModel, type.slim()); } } return BasicInjectionTarget.createDefault(type, null, manager, instantiator); }
/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }
@Override protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { if (type.isAbstract()) { ConstructorInjectionPoint<T> originalConstructor = InjectionPointFactory.instance().createConstructorInjectionPoint(bean, type, beanManager); injectionPoints.addAll(originalConstructor.getParameterInjectionPoints()); final WeldInjectionPointAttributes<?, ?> delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, injectionPoints); return new SubclassedComponentInstantiator<T>(type, bean, originalConstructor, beanManager) { @Override protected Class<T> createEnhancedSubclass(EnhancedAnnotatedType<T> type, Bean<?> bean, BeanManagerImpl manager) { return new DecoratorProxyFactory<T>(manager.getContextId(), type.getJavaClass(), delegateInjectionPoint, bean).getProxyClass(); } }; } else { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getConstructorInjectionPoint().getParameterInjectionPoints()); return instantiator; } }
/** * Returns an instantiator that will be used to create a new instance of a given component. If the instantiator uses a * constructor with injection points, the implementation of the * {@link #initInstantiator(EnhancedAnnotatedType, Bean, BeanManagerImpl, Set)} method is supposed to register all these * injection points within the injectionPoints set passed in as a parameter. */ protected Instantiator<T> initInstantiator(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager, Set<InjectionPoint> injectionPoints) { DefaultInstantiator<T> instantiator = new DefaultInstantiator<T>(type, bean, beanManager); injectionPoints.addAll(instantiator.getParameterInjectionPoints()); return instantiator; }