Inheritance: NCop.Weaving.AbstractWeaverBuilder, IMethodWeaverBuilder
Ejemplo n.º 1
0
        internal CompositeTypeWeaverBuilder(Type compositeType, INCopRegistry registry)
        {
            var mixinsMap              = new MixinsMap(compositeType);
            var aspectMappedMembers    = new AspectMemberMapper(compositeType, mixinsMap);
            var aspectsMap             = new AspectsMap(compositeType, aspectMappedMembers);
            var typeDefinitionWeaver   = new MixinsTypeDefinitionWeaver(compositeType, mixinsMap);
            var compositeMappedMembers = new CompositeMemberMapper(aspectsMap, aspectMappedMembers);
            var typeDefinition         = typeDefinitionWeaver.Weave();

            builder = new MixinsTypeWeaverBuilder(compositeType, typeDefinition, registry);

            mixinsMap.ForEach(map => {
                builder.Add(map);
            });

            compositeMappedMembers.Methods.ForEach(compositeMethodMap => {
                var methodBuilder = new CompositeMethodWeaverBuilder(compositeMethodMap, typeDefinition);

                builder.Add(methodBuilder);
            });

            compositeMappedMembers.Properties.ForEach(compositePropertyMap => {
                var propertyBuilder = new CompositePropertyWeaverBuilder(compositePropertyMap, typeDefinition);

                builder.Add(propertyBuilder);
            });
        }
        public ITypeWeaver Build()
        {
            ICompositeMixinsTypeWeaverBuilder builder = null;
            var registry               = compositeWeavingSettings.Registry;
            var mixinsMap              = compositeWeavingSettings.MixinsMap;
            var aspectsMap             = compositeWeavingSettings.AspectsMap;
            var compositeType          = compositeWeavingSettings.CompositeType;
            var aspectMappedMembers    = compositeWeavingSettings.AspectMemebrsCollection;
            var compositeMappedMembers = new CompositeMemberMapper(aspectsMap, aspectMappedMembers);
            var typeDefinitionWeaver   = new CompositeTypeDefinitionWeaver(compositeType, mixinsMap, compositeMappedMembers);
            var typeDefinition         = typeDefinitionWeaver.Weave() as IAspectTypeDefinition;

            if (IsAtomComposite(compositeType, mixinsMap))
            {
                builder = new AtomCompositeMixinsWeaverBuilder(compositeType, typeDefinition, registry);
            }
            else
            {
                builder = new CompositeMixinsWeaverBuilder(compositeType, typeDefinition, registry);
            }

            mixinsMap.ForEach(map => builder.Add(map));

            compositeMappedMembers.Events.ForEach(compositeEventMap => {
                var eventBuilder = new CompositeEventWeaverBuilder(compositeEventMap, typeDefinition, compositeWeavingSettings);

                builder.Add(eventBuilder);
            });

            compositeMappedMembers.Methods.ForEach(compositeMethodMap => {
                var methodBuilder = new CompositeMethodWeaverBuilder(compositeMethodMap, typeDefinition, compositeWeavingSettings);

                builder.Add(methodBuilder);
            });

            compositeMappedMembers.Properties.ForEach(compositePropertyMap => {
                var propertyBuilder = new CompositePropertyWeaverBuilder(compositePropertyMap, typeDefinition, compositeWeavingSettings);

                builder.Add(propertyBuilder);
            });

            return(builder.Build());
        }
Ejemplo n.º 3
0
        public ITypeWeaver Build()
        {
            ICompositeMixinsTypeWeaverBuilder builder = null;
            var registry = compositeWeavingSettings.Registry;
            var mixinsMap = compositeWeavingSettings.MixinsMap;
            var aspectsMap = compositeWeavingSettings.AspectsMap;
            var compositeType = compositeWeavingSettings.CompositeType;
            var aspectMappedMembers = compositeWeavingSettings.AspectMemebrsCollection;
            var compositeMappedMembers = new CompositeMemberMapper(aspectsMap, aspectMappedMembers);
            var typeDefinitionWeaver = new CompositeTypeDefinitionWeaver(compositeType, mixinsMap, compositeMappedMembers);
            var typeDefinition = typeDefinitionWeaver.Weave() as IAspectTypeDefinition;

            if (IsAtomComposite(compositeType, mixinsMap)) {
                builder = new AtomCompositeMixinsWeaverBuilder(compositeType, typeDefinition, registry);
            }
            else {
                builder = new CompositeMixinsWeaverBuilder(compositeType, typeDefinition, registry);
            }

            mixinsMap.ForEach(map => builder.Add(map));

            compositeMappedMembers.Events.ForEach(compositeEventMap => {
                var eventBuilder = new CompositeEventWeaverBuilder(compositeEventMap, typeDefinition, compositeWeavingSettings);

                builder.Add(eventBuilder);
            });

            compositeMappedMembers.Methods.ForEach(compositeMethodMap => {
                var methodBuilder = new CompositeMethodWeaverBuilder(compositeMethodMap, typeDefinition, compositeWeavingSettings);

                builder.Add(methodBuilder);
            });

            compositeMappedMembers.Properties.ForEach(compositePropertyMap => {
                var propertyBuilder = new CompositePropertyWeaverBuilder(compositePropertyMap, typeDefinition, compositeWeavingSettings);

                builder.Add(propertyBuilder);
            });

            return builder.Build();
        }