Search in sources :

Example 1 with BeanInstance

use of org.jboss.weld.bean.proxy.BeanInstance in project core by weld.

the class ProxyClassConstructorInjectionPointWrapper method newInstance.

@Override
protected T newInstance(Object[] parameterValues) {
    // Once the instance is created, a method handler is required regardless of whether
    // an actual bean instance is known yet.
    final T instance = super.newInstance(parameterValues);
    if (decorator) {
        BeanInstance beanInstance = null;
        if (hasDelegateInjectionPoint()) {
            Object decoratorDelegate = parameterValues[delegateInjectionPointPosition];
            beanInstance = new TargetBeanInstance(decoratorDelegate);
        }
        ProxyFactory.setBeanInstance(contextId, instance, beanInstance, bean);
    } else {
        if (instance instanceof ProxyObject) {
            ((ProxyObject) instance).setHandler(new CombinedInterceptorAndDecoratorStackMethodHandler());
            // Set method handler for private methods if necessary
            InterceptedSubclassFactory.setPrivateMethodHandler(instance);
        }
    }
    return instance;
}
Also used : ProxyObject(org.jboss.weld.bean.proxy.ProxyObject) CombinedInterceptorAndDecoratorStackMethodHandler(org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler) TargetBeanInstance(org.jboss.weld.bean.proxy.TargetBeanInstance) BeanInstance(org.jboss.weld.bean.proxy.BeanInstance) ProxyObject(org.jboss.weld.bean.proxy.ProxyObject) TargetBeanInstance(org.jboss.weld.bean.proxy.TargetBeanInstance)

Aggregations

BeanInstance (org.jboss.weld.bean.proxy.BeanInstance)1 CombinedInterceptorAndDecoratorStackMethodHandler (org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler)1 ProxyObject (org.jboss.weld.bean.proxy.ProxyObject)1 TargetBeanInstance (org.jboss.weld.bean.proxy.TargetBeanInstance)1