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 JavaMethod method, XmlReader reader) { method.Abstract = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "abstract")); method.Native = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "native")); method.Return = XmlUtil.GetRequiredAttribute(reader, "return"); method.Synchronized = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "synchronized")); XmlUtil.CheckExtraneousAttributes("method", reader, "deprecated", "final", "name", "static", "visibility", "jni-signature", "jni-return", "synthetic", "bridge", "abstract", "native", "return", "synchronized"); method.LoadMethodBase("method", reader); }
internal static void LoadTypeAttributes(this JavaType type, XmlReader reader, params string [] otherAllowedAttributes) { type.Abstract = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "abstract")); type.Deprecated = XmlUtil.GetRequiredAttribute(reader, "deprecated"); type.Final = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "final")); type.Name = XmlUtil.GetRequiredAttribute(reader, "name"); type.Static = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "static")); type.Visibility = XmlUtil.GetRequiredAttribute(reader, "visibility"); type.ExtendedJniSignature = reader.GetAttribute("jni-signature"); XmlUtil.CheckExtraneousAttributes(reader.LocalName, reader, expected_type_attributes.Concat(otherAllowedAttributes).ToArray()); }
public static void Load(this JavaImplements implements, XmlReader reader) { implements.Name = XmlUtil.GetRequiredAttribute(reader, "name"); implements.NameGeneric = XmlUtil.GetRequiredAttribute(reader, "name-generic-aware"); implements.ExtendedJniType = reader.GetAttribute("jni-type"); XmlUtil.CheckExtraneousAttributes(reader.LocalName, reader, "name", "name-generic-aware", "jni-type"); if (!reader.IsEmptyElement) { reader.Read(); reader.MoveToContent(); XmlUtil.VerifyEndElement(reader, "implements"); } reader.Read(); }
public static void Load(this JavaApi api, XmlReader reader, bool isReferenceOnly) { reader.MoveToContent(); if (reader.LocalName != "api") { throw XmlUtil.UnexpectedElementOrContent(null, reader, "api"); } api.ExtendedApiSource = reader.GetAttribute("api-source"); api.Platform = reader.GetAttribute("platform"); XmlUtil.CheckExtraneousAttributes("api", reader, "api-source", "platform"); if (reader.IsEmptyElement) { reader.Read(); } else { reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; // </api> } if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "package") { throw XmlUtil.UnexpectedElementOrContent("api", reader, "package"); } var name = reader.GetAttribute("name"); if (!api.Packages.TryGetValue(name, out var pkg)) { pkg = new JavaPackage(api); api.Packages.Add(name, pkg); } pkg.Load(reader, isReferenceOnly); } while (true); XmlUtil.VerifyEndElement(reader, "api"); reader.Read(); } }
public static void Load(this JavaGenericConstraint gc, XmlReader reader) { gc.Type = XmlUtil.GetRequiredAttribute(reader, "type"); XmlUtil.CheckExtraneousAttributes("genericConstraint", reader, "type"); reader.Skip(); }
public static void Load(this JavaTypeParameter tp, XmlReader reader) { tp.Name = XmlUtil.GetRequiredAttribute(reader, "name"); tp.ExtendedJniClassBound = reader.GetAttribute("jni-classBound"); // such an ill-named attribute... tp.ExtendedClassBound = reader.GetAttribute("classBound"); // and un-structuring attribute... tp.ExtendedInterfaceBounds = reader.GetAttribute("interfaceBounds"); tp.ExtendedJniInterfaceBounds = reader.GetAttribute("jni-interfaceBounds"); XmlUtil.CheckExtraneousAttributes("typeParameter", reader, "name", "jni-classBound", "jni-interfaceBounds", "classBound", "interfaceBounds"); if (reader.IsEmptyElement) { reader.Read(); } else { reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; // </typeParameter> } if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "genericConstraints") { throw XmlUtil.UnexpectedElementOrContent("typeParameter", reader, "genericConstraints"); } var gc = new JavaGenericConstraints(); gc.Load(reader); tp.GenericConstraints = gc; } while (true); XmlUtil.VerifyEndElement(reader, "typeParameter"); reader.Read(); } // Now we have to deal with the format difference... // Some versions of class-parse stopped generating <genericConstraints> but started // generating "classBound" and "interfaceBounds" attributes instead. // They don't make sense and blocking this effort, but we have to deal with that... if (!string.IsNullOrEmpty(tp.ExtendedClassBound) || !string.IsNullOrEmpty(tp.ExtendedInterfaceBounds)) { var gcs = new JavaGenericConstraints(); if (!string.IsNullOrEmpty(tp.ExtendedClassBound)) { gcs.GenericConstraints.Add(new JavaGenericConstraint() { Type = tp.ExtendedClassBound }); } if (!string.IsNullOrEmpty(tp.ExtendedInterfaceBounds)) { foreach (var ic in tp.ExtendedInterfaceBounds.Split(':')) { gcs.GenericConstraints.Add(new JavaGenericConstraint() { Type = ic }); } } tp.GenericConstraints = gcs; } }