コード例 #1
0
        /// <summary>
        /// Add a new <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/>
        /// that will get applied to objects created by this factory.
        /// </summary>
        /// <param name="objectPostProcessor">
        /// The <see cref="Spring.Objects.Factory.Config.IObjectPostProcessor"/>
        /// to register.
        /// </param>
        /// <seealso cref="Spring.Objects.Factory.Config.IConfigurableObjectFactory.AddObjectPostProcessor"/>.
        public void AddObjectPostProcessor(IObjectPostProcessor objectPostProcessor)
        {
            if (objectPostProcessor is IObjectFactoryAware)
            {
                ((IObjectFactoryAware)objectPostProcessor).ObjectFactory = this;
            }

            // ensure the same instance doesn't get registered twice
            if (!ObjectPostProcessors.Contains(objectPostProcessor))
            {
                ObjectPostProcessors.Add(objectPostProcessor);
            }
            if (typeof(IInstantiationAwareObjectPostProcessor).IsInstanceOfType(objectPostProcessor))
            {
                hasInstantiationAwareBeanPostProcessors = true;
            }
            if (typeof(IDestructionAwareObjectPostProcessor).IsInstanceOfType(objectPostProcessor))
            {
                hasDestructionAwareBeanPostProcessors = true;
            }
        }
コード例 #2
0
 /// <summary>
 /// Adds the given <see cref="IObjectPostProcessor"/> to the list of standard
 /// processors being added to the underlying <see cref="IConfigurableObjectFactory"/>
 /// </summary>
 /// <remarks>
 /// Each time <see cref="Refresh()"/> is called on this context, the context ensures, that 
 /// all default <see cref="IObjectPostProcessor"/>s are registered with the underlying <see cref="IConfigurableObjectFactory"/>.
 /// </remarks>
 /// <param name="defaultObjectPostProcessor">The <see cref="IObjectPostProcessor"/> instance.</param>
 protected void AddDefaultObjectPostProcessor(IObjectPostProcessor defaultObjectPostProcessor)
 {
     _defaultObjectPostProcessors.Add(defaultObjectPostProcessor);
 }
コード例 #3
0
 public ObjectProducer(IServiceInstanceGenerator serviceInstanceGenerator, IObjectPostProcessor postProcessor)
 {
     ServiceInstanceGenerator = serviceInstanceGenerator;
     PostProcessor            = postProcessor;
 }