Ejemplo n.º 1
0
        public void AddStaticUtilsClass(string wrappedObjPropName, Type staticMethodsContainerClass)
        {
            WrappedObjInfo wrappedObjInfo =
                _wrappedObjInfos.Single(wrappedObj => wrappedObj.WrappedObjPropName == wrappedObjPropName);

            wrappedObjInfo.AddStaticMethodsContainerType(staticMethodsContainerClass);
        }
Ejemplo n.º 2
0
        WrappedObjInfo GetWrappedObjInfo(string wrappedObjPropName)
        {
            WrappedObjInfo wrappedObjInfo =
                this._wrappedObjInfos.FirstOrDefault(wrObjInfo => wrObjInfo.WrappedObjPropName == wrappedObjPropName);

            if (wrappedObjInfo == null)
            {
                throw new Exception($"Error no wrapped object property name '{wrappedObjPropName}' found.");
            }

            return(wrappedObjInfo);
        }
Ejemplo n.º 3
0
        public void SetMemberMapAllowNonPublic
        (
            string wrappedObjPropName,
            params string[] wrapperMemberNames // we pass wrapper member names (not wrapped)
        )
        {
            ThrowErrorIfCompleted();

            WrappedObjInfo wrappedObjInfo = GetWrappedObjInfo(wrappedObjPropName);

            wrapperMemberNames
            .DoForEach(wrapperMemberName => SetMemberMap(wrappedObjPropName, null, wrapperMemberName, true));
        }
Ejemplo n.º 4
0
        public void SetMemberMap
        (
            string wrappedObjPropName,
            string wrappedMemberName,
            string wrapperMemberName,
            bool?allowNonPublic = null
        )
        {
            ThrowErrorIfCompleted();

            WrappedObjInfo wrappedObjInfo = GetWrappedObjInfo(wrappedObjPropName);

            wrappedObjInfo.SetMap(wrappedMemberName, wrapperMemberName, allowNonPublic);
        }
Ejemplo n.º 5
0
        protected void SetFromSymbols
        (
            INamedTypeSymbol implInterfaceTypeSymbol,
            INamedTypeSymbol superClassTypeSymbol,
            INamedTypeSymbol wrapInterfaceTypeSymbol
        )
        {
            this.ImplInterfaceTypeSymbol = implInterfaceTypeSymbol;
            this.SuperClassTypeSymbol    = superClassTypeSymbol;
            this.WrapInterfaceTypeSymbol = wrapInterfaceTypeSymbol;

            this.ClassName = ImplInterfaceTypeSymbol.GetClassName(this.ClassName);

            if (ImplInterfaceTypeSymbol.TypeKind != TypeKind.Interface)
            {
                throw new Exception($"Error: ImplementedInterface type '{ImplInterfaceTypeSymbol.Name}' is not interface.");
            }

            if ((SuperClassTypeSymbol.TypeKind != TypeKind.Class))
            {
                throw new Exception($"Error: Class to extend type '{SuperClassTypeSymbol.Name}' is not a class.");
            }

            if (WrapInterfaceTypeSymbol.TypeKind != TypeKind.Interface)
            {
                throw new Exception($"Error: WrappedInterface type '{WrapInterfaceTypeSymbol.Name}' is not interface.");
            }

            if ((!HasInterfaceToImplement) && (!HasClassToExtend))
            {
                throw new Exception($"Error: there is neither interface to implement, no class to extend - no public members.");
            }

            IEnumerable <ISymbol> props =
                WrapInterfaceTypeSymbol
                .GetMembers()
                .Where(symbol => symbol is IPropertySymbol);

            foreach (ISymbol prop in props)
            {
                WrappedObjInfo wrappedObjInfo =
                    new WrappedObjInfo {
                    WrappedObjPropName = prop.Name, TheCore = this.TheCore
                };

                _wrappedObjInfos.Add(wrappedObjInfo);
            }

            SetMembersFromCompilation();
        }
Ejemplo n.º 6
0
        public void SetAllowNonPublicForAllMembers(string wrappedObjPropName)
        {
            WrappedObjInfo wrappedObjInfo = GetWrappedObjInfo(wrappedObjPropName);

            wrappedObjInfo.AllowNonPublicForAllMemberMaps = true;
        }