public static void Load(this JavaConstructor constructor, XmlReader reader)
 {
     // it was required in the original API XML, but removed in class-parsed...
     constructor.Type = reader.GetAttribute("type");
     XmlUtil.CheckExtraneousAttributes("constructor", reader, "deprecated", "final", "name", "static", "visibility", "jni-signature", "jni-return", "synthetic", "bridge",
                                       "type");
     constructor.LoadMethodBase("constructor", reader);
 }
        public static void Load(this JavaClass kls, XmlReader reader)
        {
            reader.MoveToContent();
            kls.LoadTypeAttributes(reader, "extends", "extends-generic-aware", "jni-extends");
            // they are not mandatory; Java.Lang.Object doesn't have them.
            kls.Extends            = reader.GetAttribute("extends");
            kls.ExtendsGeneric     = reader.GetAttribute("extends-generic-aware");
            kls.ExtendedJniExtends = reader.GetAttribute("jni-extends");

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                reader.Read();
            }
            else
            {
                reader.Read();
                do
                {
                    reader.MoveToContent();
                    if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        break;                         // </interface>
                    }
                    if (reader.NodeType != XmlNodeType.Element)
                    {
                        throw XmlUtil.UnexpectedElementOrContent("class", reader, "implements", "typeParameters", "field", "constructor", "method");
                    }
                    if (!kls.TryLoadCommonElement(reader))
                    {
                        if (reader.LocalName == "constructor")
                        {
                            var constructor = new JavaConstructor(kls);
                            constructor.Load(reader);
                            kls.Members.Add(constructor);
                        }
                        else
                        {
                            throw XmlUtil.UnexpectedElementOrContent("class", reader, "implements", "typeParameters", "field", "constructor", "method");
                        }
                    }
                } while (true);
                XmlUtil.VerifyEndElement(reader, "class");
                reader.Read();
            }
        }
        static void Load(this JavaClass kls, ClassGen gen)
        {
            ((JavaType)kls).Load(gen);

            kls.Abstract = gen.IsAbstract;
            kls.Final    = gen.IsFinal;
            if (gen.BaseGen != null)
            {
                kls.Extends            = gen.BaseGen.JavaSimpleName;
                kls.ExtendsGeneric     = gen.BaseGen.JavaSimpleName + ExpandTypeParameters(gen.BaseGen.TypeParameters);
                kls.ExtendedJniExtends = gen.BaseGen.JniName;
            }
            foreach (var c in gen.Ctors)
            {
                var ctor = new JavaConstructor(kls);
                ctor.Load(c);
                kls.Members.Add(ctor);
            }
        }
        static void Load(this JavaClass kls, ClassGen gen)
        {
            ((JavaType)kls).Load(gen);

            kls.Abstract = gen.IsAbstract;
            kls.Final    = gen.IsFinal;
            var baseGen = gen.BaseType != null?SymbolTable.Lookup(gen.BaseType) : null;

            if (baseGen != null)
            {
                kls.Extends = baseGen.JavaName;
                var gs = baseGen as GenericSymbol;
                kls.ExtendsGeneric     = gs != null ? gs.JavaName + ExpandTypeParameters(gs.TypeParams) : baseGen.JavaName;
                kls.ExtendedJniExtends = baseGen.JniName;
            }
            foreach (var c in gen.Ctors)
            {
                var ctor = new JavaConstructor(kls);
                ctor.Load(c);
                kls.Members.Add(ctor);
            }
        }
Exemple #5
0
 static void Save(this JavaConstructor ctor, XmlWriter writer)
 {
     SaveCommon(ctor, writer, "constructor", null, null, null, null, null, ctor.Type ?? ctor.Parent.FullName, null, null, null, ctor.TypeParameters, ctor.Parameters, ctor.Exceptions, ctor.ExtendedBridge, ctor.ExtendedJniReturn, ctor.ExtendedSynthetic);
 }
 static void Load(this JavaConstructor ctor, Ctor gc)
 {
     ((JavaMethodBase)ctor).Load(gc);
 }
 static void Save(this JavaConstructor ctor, XmlWriter writer)
 {
     SaveCommon(ctor, writer, "constructor", null, null, null, null, null, ctor.Type ?? ctor.Parent.FullName, null, null, null, null, ctor.Parameters, ctor.Exceptions);
 }
 public static void Resolve(this JavaConstructor c)
 {
     c.ResolveMethodBase();
 }