Search in sources :

Example 1 with AbstractInstantiator

use of org.jboss.weld.injection.producer.AbstractInstantiator in project core by weld.

the class EjbSupportImpl method createMessageDrivenInjectionTarget.

@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);
}
Also used : AbstractInstantiator(org.jboss.weld.injection.producer.AbstractInstantiator) InterceptionModel(org.jboss.weld.interceptor.spi.model.InterceptionModel)

Aggregations

AbstractInstantiator (org.jboss.weld.injection.producer.AbstractInstantiator)1 InterceptionModel (org.jboss.weld.interceptor.spi.model.InterceptionModel)1