internal static PatternTokenizer DeserializePatternTokenizer(JsonElement element) { string pattern = default; RegexFlags?flags = default; int? group = default; string odatatype = default; string name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("pattern")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } pattern = property.Value.GetString(); continue; } if (property.NameEquals("flags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } flags = new RegexFlags(property.Value.GetString()); continue; } if (property.NameEquals("group")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } group = property.Value.GetInt32(); continue; } if (property.NameEquals("@odata.type")) { odatatype = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } } return(new PatternTokenizer(odatatype, name, pattern, flags, group)); }
internal static PatternAnalyzer DeserializePatternAnalyzer(JsonElement element) { bool? lowercase = default; string pattern = default; RegexFlags? flags = default; IList <string> stopwords = default; string odatatype = default; string name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lowercase")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } lowercase = property.Value.GetBoolean(); continue; } if (property.NameEquals("pattern")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } pattern = property.Value.GetString(); continue; } if (property.NameEquals("flags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } flags = new RegexFlags(property.Value.GetString()); continue; } if (property.NameEquals("stopwords")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <string> array = new List <string>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(item.GetString()); } stopwords = array; continue; } if (property.NameEquals("@odata.type")) { odatatype = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } } return(new PatternAnalyzer(odatatype, name, lowercase, pattern, flags, stopwords)); }