internal static void Load(this JavaParameter p, XmlReader reader) { p.Name = XmlUtil.GetRequiredAttribute(reader, "name"); p.Type = XmlUtil.GetRequiredAttribute(reader, "type"); p.JniType = reader.GetAttribute("jni-type"); reader.Skip(); }
internal static void Load(this JavaException e, XmlReader reader) { e.Name = XmlUtil.GetRequiredAttribute(reader, "name"); e.Type = XmlUtil.GetRequiredAttribute(reader, "type"); e.Type = reader.GetAttribute("type-generic-aware"); reader.Skip(); }
public static void Load(this JavaPackage package, XmlReader reader, bool isReferenceOnly) { reader.MoveToContent(); package.Name = XmlUtil.GetRequiredAttribute(reader, "name"); package.JniName = reader.GetAttribute("jni-name"); if (reader.MoveToFirstAttribute()) { if (reader.LocalName != "name") { throw XmlUtil.UnexpectedAttribute(reader, "package"); } } reader.MoveToElement(); if (reader.IsEmptyElement) { reader.Read(); } else { reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; // </package> } if (reader.NodeType != XmlNodeType.Element) { throw XmlUtil.UnexpectedElementOrContent("package", reader, "class", "interface"); } if (reader.LocalName == "class") { var kls = new JavaClass(package) { IsReferenceOnly = isReferenceOnly }; kls.Load(reader); package.AddType(kls); } else if (reader.LocalName == "interface") { var iface = new JavaInterface(package) { IsReferenceOnly = isReferenceOnly }; iface.Load(reader); package.AddType(iface); } else { throw XmlUtil.UnexpectedElementOrContent("package", reader, "class", "interface"); } } while (true); XmlUtil.VerifyEndElement(reader, "package"); reader.Read(); } }
public static void LoadMemberAttributes(this JavaMember member, XmlReader reader) { member.Deprecated = XmlUtil.GetRequiredAttribute(reader, "deprecated"); member.Final = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "final")); member.Name = XmlUtil.GetRequiredAttribute(reader, "name"); member.Static = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "static")); member.Visibility = XmlUtil.GetRequiredAttribute(reader, "visibility"); }
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 JavaField field, XmlReader reader) { field.LoadMemberAttributes(reader); field.Transient = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "transient")); field.Volatile = XmlConvert.ToBoolean(XmlUtil.GetRequiredAttribute(reader, "transient")); field.Type = XmlUtil.GetRequiredAttribute(reader, "type"); field.TypeGeneric = XmlUtil.GetRequiredAttribute(reader, "type-generic-aware"); field.Value = reader.GetAttribute("value"); reader.Skip(); }
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 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; } }