public static String RegisterWithGeneratedName(AbstractObjectDefinition definition, IObjectDefinitionRegistry registry)
        {
            String generatedName = GenerateObjectName(definition, registry, false);

            registry.RegisterObjectDefinition(generatedName, definition);
            return(generatedName);
        }
        /// <summary>
        /// Override settings in this object definition from the supplied
        /// <paramref name="other"/> object definition.
        /// </summary>
        /// <param name="other">
        /// The object definition used to override the member fields of this instance.
        /// </param>
        public virtual void OverrideFrom(IObjectDefinition other)
        {
            AssertUtils.ArgumentNotNull(other, "other");

            IsAbstract = other.IsAbstract;
            Scope      = other.Scope;
            IsLazyInit = other.IsLazyInit;
            ConstructorArgumentValues.AddAll(other.ConstructorArgumentValues);
            PropertyValues.AddAll(other.PropertyValues.PropertyValues);
            EventHandlerValues.AddAll(other.EventHandlerValues);
            if (StringUtils.HasText(other.ObjectTypeName))
            {
                ObjectTypeName = other.ObjectTypeName;
            }
            if (StringUtils.HasText(other.InitMethodName))
            {
                InitMethodName = other.InitMethodName;
            }
            if (StringUtils.HasText(other.DestroyMethodName))
            {
                DestroyMethodName = other.DestroyMethodName;
            }
            if (StringUtils.HasText(other.FactoryObjectName))
            {
                FactoryObjectName = other.FactoryObjectName;
            }
            if (StringUtils.HasText(other.FactoryMethodName))
            {
                FactoryMethodName = other.FactoryMethodName;
            }
            if (other.DependsOn != null && other.DependsOn.Count > 0)
            {
                List <string> deps = new List <string>(other.DependsOn);
                if (DependsOn != null && DependsOn.Count > 0)
                {
                    deps.AddRange(DependsOn);
                }
                DependsOn = deps;
            }
            AutowireMode        = other.AutowireMode;
            ResourceDescription = other.ResourceDescription;
            IsPrimary           = other.IsPrimary;
            IsAutowireCandidate = other.IsAutowireCandidate;

            AbstractObjectDefinition aod = other as AbstractObjectDefinition;

            if (aod != null)
            {
                if (aod.HasObjectType)
                {
                    ObjectType = other.ObjectType;
                }

                MethodOverrides.AddAll(aod.MethodOverrides);
                DependencyCheck = aod.DependencyCheck;
                CopyQualifiersFrom(aod);
            }
        }
 /// <summary>
 /// Copy the qualifiers from the supplied AbstractBeanDefinition to this bean definition.
 /// </summary>
 /// <param name="source">the AbstractBeanDefinition to copy from</param>
 public void CopyQualifiersFrom(AbstractObjectDefinition source)
 {
     Trace.Assert(source != null, "Source must not be null");
     foreach (var qualifier in source.qualifiers)
     {
         if (!qualifiers.Contains(qualifier))
         {
             qualifiers.Add(qualifier);
         }
     }
 }
        /// <summary>
        /// Creates a new instance of the
        /// <see cref="Oragon.Spring.Objects.Factory.Support.AbstractObjectDefinition"/>
        /// class.
        /// </summary>
        /// <param name="other">
        /// The object definition used to initialise the member fields of this
        /// instance.
        /// </param>
        /// <remarks>
        /// <p>
        /// This is an <see langword="abstract"/> class, and as such exposes no
        /// public constructors.
        /// </p>
        /// </remarks>
        protected AbstractObjectDefinition(IObjectDefinition other)
        {
            AssertUtils.ArgumentNotNull(other, "other");
            this.OverrideFrom(other);

            AbstractObjectDefinition aod = other as AbstractObjectDefinition;

            if (aod != null)
            {
                if (aod.HasObjectType)
                {
                    ObjectType = other.ObjectType;
                }
                else
                {
                    ObjectTypeName = other.ObjectTypeName;
                }
                MethodOverrides = new MethodOverrides(aod.MethodOverrides);
                DependencyCheck = aod.DependencyCheck;
            }
            ParentName = other.ParentName;
            IsAbstract = other.IsAbstract;
//            IsSingleton = other.IsSingleton;
            Scope      = other.Scope;
            Role       = other.Role;
            IsLazyInit = other.IsLazyInit;
            ConstructorArgumentValues
                               = new ConstructorArgumentValues(other.ConstructorArgumentValues);
            PropertyValues     = new MutablePropertyValues(other.PropertyValues);
            EventHandlerValues = new EventValues(other.EventHandlerValues);

            InitMethodName      = other.InitMethodName;
            DestroyMethodName   = other.DestroyMethodName;
            IsAutowireCandidate = other.IsAutowireCandidate;
            IsPrimary           = other.IsPrimary;
            CopyQualifiersFrom(aod);
            DependsOn           = new List <string>(other.DependsOn);
            FactoryMethodName   = other.FactoryMethodName;
            FactoryObjectName   = other.FactoryObjectName;
            AutowireMode        = other.AutowireMode;
            ResourceDescription = other.ResourceDescription;
        }