protected override void OnLoadRecord(string[] record) { if (record.Length < (int)Column.Messages) { return; } var supportNamespace = record[(int)Column.SupportNetNamespace]; var supportType = record[(int)Column.SupportNetType]; var xNamespace = record[(int)Column.AndroidXNetNamespace]; var xType = record[(int)Column.AndroidXNetType]; var xAssembly = record[(int)Column.AndroidXNetAssembly]; if (!string.IsNullOrWhiteSpace(supportNamespace) && !string.IsNullOrWhiteSpace(supportType) && !string.IsNullOrWhiteSpace(xNamespace) && !string.IsNullOrWhiteSpace(xType) && !string.IsNullOrWhiteSpace(xAssembly)) { var support = new FullType(supportNamespace, supportType); var androidX = new FullType(xAssembly, xNamespace, xType); mapping[support.FullName] = androidX; reverseMapping[androidX.FullName] = support; } var supportPackage = record[(int)Column.SupportJavaPackage]; var supportClass = record[(int)Column.SupportJavaClass]; var xPackage = record[(int)Column.AndroidXJavaPackage]; var xClass = record[(int)Column.AndroidXJavaClass]; if (!string.IsNullOrWhiteSpace(supportPackage) && !string.IsNullOrWhiteSpace(supportClass) && !string.IsNullOrWhiteSpace(xPackage) && !string.IsNullOrWhiteSpace(xClass)) { var supportJava = new FullType(supportPackage, supportClass); var androidXJava = new FullType(xPackage, xClass); javaMapping[supportJava.JavaFullName] = androidXJava; } }
private bool TryGetMapping(Dictionary <string, string> mappings, FullType type, out string androidx) { if (mappings.TryGetValue(type.FullName, out androidx)) { return(true); } string nested = ""; while (type.Name.Contains(".")) { nested = type.Name.Substring(type.Name.LastIndexOf(".")) + nested; type = type.WithName(type.Name.Substring(0, type.Name.LastIndexOf("."))); if (mappings.TryGetValue(type.FullName, out androidx)) { androidx += nested; return(true); } } return(false); }
public BindingType(FullType netType, FullType javaType) { NetType = netType; JavaType = javaType; }
public bool TryGetSupportType(string androidxFullName, out FullType supportType) => reverseMapping.TryGetValue(androidxFullName, out supportType);
public bool TryGetAndroidXClass(string supportJavaFullName, out FullType androidxClass) => javaMapping.TryGetValue(supportJavaFullName, out androidxClass);
public bool TryGetAndroidXType(string supportFullName, out FullType androidxType) => mapping.TryGetValue(supportFullName, out androidxType);