Esempio n. 1
0
        void AddPropertyInvokers(ClassGen klass, IEnumerable <Property> properties, HashSet <string> members, CodeGenerationOptions opt)
        {
            foreach (var prop in properties)
            {
                if (members.Contains(prop.Name))
                {
                    continue;
                }

                members.Add(prop.Name);

                if ((prop.Getter != null && !prop.Getter.IsAbstract) || (prop.Setter != null && !prop.Setter.IsAbstract))
                {
                    continue;
                }

                var bound_property = new BoundProperty(klass, prop, opt, false, true);
                Properties.Add(bound_property);

                if (prop.Type.StartsWith("Java.Lang.ICharSequence") && !bound_property.IsOverride)
                {
                    Properties.Add(new BoundPropertyStringVariant(prop, opt));
                }
            }
        }
Esempio n. 2
0
        void AddProperty(ClassGen klass, Property property, CodeGenerationOptions opt)
        {
            var bound_property = new BoundProperty(klass, property, opt, true, false);

            Properties.Add(bound_property);

            if (property.Type.StartsWith("Java.Lang.ICharSequence") && !bound_property.IsOverride)
            {
                Properties.Add(new BoundPropertyStringVariant(property, opt));
            }
        }
Esempio n. 3
0
        void AddProperties(InterfaceGen iface, CodeGenerationOptions opt)
        {
            foreach (var prop in iface.Properties.Where(p => !p.Getter.IsStatic && !p.Getter.IsInterfaceDefaultMethod))
            {
                Properties.Add(new BoundInterfacePropertyDeclaration(iface, prop, iface.AssemblyQualifiedName + "Invoker", opt));
            }

            if (!opt.SupportDefaultInterfaceMethods)
            {
                return;
            }

            var dim_properties = iface.Properties.Where(p => p.Getter.IsInterfaceDefaultMethod || p.Getter.IsStatic);

            foreach (var prop in dim_properties)
            {
                if (prop.Getter.IsAbstract)
                {
                    var baseProp = iface.BaseSymbol != null?iface.BaseSymbol.GetPropertyByName(prop.Name, true) : null;

                    if (baseProp != null)
                    {
                        if (baseProp.Type != prop.Getter.Return)
                        {
                            // This may not be required if we can change generic parameter support to return constrained type (not just J.L.Object).
                            //writer.WriteLine ("{0}// skipped generating property {1} because its Java method declaration is variant that we cannot represent in C#", indent, property.Name);
                            return;
                        }
                    }

                    var bound_property = new BoundAbstractProperty(iface, prop, opt);
                    Properties.Add(bound_property);

                    if (prop.Type.StartsWith("Java.Lang.ICharSequence", StringComparison.Ordinal) && !bound_property.IsOverride)
                    {
                        Properties.Add(new BoundPropertyStringVariant(prop, opt));
                    }
                }
                else
                {
                    var bound_property = new BoundProperty(iface, prop, opt, true, false);
                    Properties.Add(bound_property);

                    if (prop.Type.StartsWith("Java.Lang.ICharSequence", StringComparison.Ordinal) && !bound_property.IsOverride)
                    {
                        Properties.Add(new BoundPropertyStringVariant(prop, opt));
                    }
                }
            }
        }