internal static bool TryLoadCommonElement(this JavaType type, XmlReader reader) { if (reader.LocalName == "implements") { var implements = new JavaImplements(); implements.Load(reader); type.Implements.Add(implements); } else if (reader.LocalName == "typeParameters") { var tp = new JavaTypeParameters(type); tp.Load(reader); type.TypeParameters = tp; } else if (reader.LocalName == "field") { var field = new JavaField(type); field.Load(reader); type.Members.Add(field); } else if (reader.LocalName == "method") { var method = new JavaMethod(type); method.Load(reader); type.Members.Add(method); } else { return(false); } return(true); }
static void Load(this JavaType type, GenBase gen) { type.IsReferenceOnly = true; type.Name = gen.JavaSimpleName; type.ExtendedJniSignature = gen.JniName; type.Deprecated = gen.DeprecatedComment; type.Visibility = gen.RawVisibility; type.Implements = gen.Interfaces.Select(_ => new JavaImplements() { Name = _.JavaName, ExtendedJniType = _.JniName, }).ToArray(); if (gen.TypeParameters != null && gen.TypeParameters.Any()) { type.TypeParameters = new JavaTypeParameters(type); type.TypeParameters.Load(gen.TypeParameters); } foreach (var f in gen.Fields.Where(_ => _.IsAcw)) { var fld = new JavaField(type); fld.Load(f); type.Members.Add(fld); } foreach (var p in gen.Properties) { if (p.Getter != null && p.Getter.IsAcw) { var getter = new JavaMethod(type); getter.Load(p.Getter); type.Members.Add(getter); } if (p.Setter != null && p.Setter.IsAcw) { var setter = new JavaMethod(type); setter.Load(p.Setter); type.Members.Add(setter); } } foreach (var m in gen.Methods.Where(_ => _.IsAcw)) { var method = new JavaMethod(type); method.Load(m); type.Members.Add(method); } }