public Object PostProcessBean(IBeanContextFactory beanContextFactory, IServiceContext beanContext, IBeanConfiguration beanConfiguration, Type beanType, Object targetBean, ISet <Type> requestedTypes) { IProxyTargetAccessor factory = null; ICascadedInterceptor cascadedInterceptor = null; Object proxiedTargetBean = targetBean; if (targetBean is IProxyTargetAccessor) { factory = (IProxyTargetAccessor)targetBean; IInterceptor[] interceptors = factory.GetInterceptors(); IInterceptor callback = (interceptors != null && interceptors.Length > 0 ? interceptors[0] : null); if (callback is ICascadedInterceptor) { cascadedInterceptor = (ICascadedInterceptor)callback; proxiedTargetBean = cascadedInterceptor.Target; } } ICascadedInterceptor interceptor = HandleServiceIntern(beanContextFactory, beanContext, beanConfiguration, proxiedTargetBean.GetType(), requestedTypes); if (interceptor == null) { return(targetBean); } if (log.DebugEnabled) { log.Debug("Proxying bean with name '" + beanConfiguration.GetName() + "' by " + GetType().FullName); } Object target; if (cascadedInterceptor != null) { target = cascadedInterceptor; } else { target = proxiedTargetBean; } interceptor.Target = target; Object proxy = ProxyFactory.CreateProxy(requestedTypes.ToArray(), interceptor); postHandleServiceIntern(beanContextFactory, beanContext, beanConfiguration, proxiedTargetBean.GetType(), requestedTypes, proxy); return(proxy); }
public ICascadedInterceptor Wrap(Object target, ICascadedInterceptor interceptor) { interceptor.Target = target; return(interceptor); }