use of org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler 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;
}
use of org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler in project core by weld.
the class AbstractDecoratorApplyingInstantiator method registerOuterDecorator.
protected void registerOuterDecorator(ProxyObject instance, T outerDelegate) {
CombinedInterceptorAndDecoratorStackMethodHandler wrapperMethodHandler = (CombinedInterceptorAndDecoratorStackMethodHandler) instance.getHandler();
wrapperMethodHandler.setOuterDecorator(outerDelegate);
}
use of org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler in project core by weld.
the class SessionBeanInjectionTarget method produce.
@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;
}
use of org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler in project core by weld.
the class InterceptorApplyingInstantiator method applyInterceptors.
protected T applyInterceptors(T instance, InterceptionContext interceptionContext) {
try {
InterceptorMethodHandler methodHandler = new InterceptorMethodHandler(interceptionContext);
CombinedInterceptorAndDecoratorStackMethodHandler wrapperMethodHandler = (CombinedInterceptorAndDecoratorStackMethodHandler) ((ProxyObject) instance).getHandler();
wrapperMethodHandler.setInterceptorMethodHandler(methodHandler);
} catch (Exception e) {
throw new DeploymentException(e);
}
return instance;
}
Aggregations