internal DocumentTable(int rowCount, int columnCount, IReadOnlyList <DocumentTableCell> cells, DocumentCaption caption, IReadOnlyList <DocumentFootnote> footnotes, IReadOnlyList <BoundingRegion> boundingRegions, IReadOnlyList <DocumentSpan> spans) { RowCount = rowCount; ColumnCount = columnCount; Cells = cells; Caption = caption; Footnotes = footnotes; BoundingRegions = boundingRegions; Spans = spans; }
internal static DocumentTable DeserializeDocumentTable(JsonElement element) { int rowCount = default; int columnCount = default; IReadOnlyList <DocumentTableCell> cells = default; Optional <DocumentCaption> caption = default; Optional <IReadOnlyList <DocumentFootnote> > footnotes = default; Optional <IReadOnlyList <BoundingRegion> > boundingRegions = default; IReadOnlyList <DocumentSpan> spans = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("rowCount")) { rowCount = property.Value.GetInt32(); continue; } if (property.NameEquals("columnCount")) { columnCount = property.Value.GetInt32(); continue; } if (property.NameEquals("cells")) { List <DocumentTableCell> array = new List <DocumentTableCell>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentTableCell.DeserializeDocumentTableCell(item)); } cells = array; continue; } if (property.NameEquals("caption")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } caption = DocumentCaption.DeserializeDocumentCaption(property.Value); continue; } if (property.NameEquals("footnotes")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <DocumentFootnote> array = new List <DocumentFootnote>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentFootnote.DeserializeDocumentFootnote(item)); } footnotes = array; continue; } if (property.NameEquals("boundingRegions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <BoundingRegion> array = new List <BoundingRegion>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(BoundingRegion.DeserializeBoundingRegion(item)); } boundingRegions = array; continue; } if (property.NameEquals("spans")) { List <DocumentSpan> array = new List <DocumentSpan>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(DocumentSpan.DeserializeDocumentSpan(item)); } spans = array; continue; } } return(new DocumentTable(rowCount, columnCount, cells, caption.Value, Optional.ToList(footnotes), Optional.ToList(boundingRegions), spans)); }