Esempio n. 1
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "color":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Color = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Color.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Color.Count == 0)
                {
                    Color = null;
                }

                break;

            case "_color":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _Color = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_Color = new fhirCsR4.Models.Element();
                    obj_Color.DeserializeJson(ref reader, options);
                    _Color.Add(obj_Color);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_Color.Count == 0)
                {
                    _Color = null;
                }

                break;

            case "depth":
                Depth = new fhirCsR4.Models.Quantity();
                Depth.DeserializeJson(ref reader, options);
                break;

            case "externalDiameter":
                ExternalDiameter = new fhirCsR4.Models.Quantity();
                ExternalDiameter.DeserializeJson(ref reader, options);
                break;

            case "height":
                Height = new fhirCsR4.Models.Quantity();
                Height.DeserializeJson(ref reader, options);
                break;

            case "image":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Image = new List <Attachment>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Attachment objImage = new fhirCsR4.Models.Attachment();
                    objImage.DeserializeJson(ref reader, options);
                    Image.Add(objImage);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Image.Count == 0)
                {
                    Image = null;
                }

                break;

            case "imprint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Imprint = new List <string>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Imprint.Add(reader.GetString());

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Imprint.Count == 0)
                {
                    Imprint = null;
                }

                break;

            case "_imprint":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                _Imprint = new List <Element>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Element obj_Imprint = new fhirCsR4.Models.Element();
                    obj_Imprint.DeserializeJson(ref reader, options);
                    _Imprint.Add(obj_Imprint);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (_Imprint.Count == 0)
                {
                    _Imprint = null;
                }

                break;

            case "nominalVolume":
                NominalVolume = new fhirCsR4.Models.Quantity();
                NominalVolume.DeserializeJson(ref reader, options);
                break;

            case "scoring":
                Scoring = new fhirCsR4.Models.CodeableConcept();
                Scoring.DeserializeJson(ref reader, options);
                break;

            case "shape":
                Shape = reader.GetString();
                break;

            case "_shape":
                _Shape = new fhirCsR4.Models.Element();
                _Shape.DeserializeJson(ref reader, options);
                break;

            case "weight":
                Weight = new fhirCsR4.Models.Quantity();
                Weight.DeserializeJson(ref reader, options);
                break;

            case "width":
                Width = new fhirCsR4.Models.Quantity();
                Width.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.BackboneElement) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if ((SupportingInfoSequence != null) && (SupportingInfoSequence.Count != 0))
            {
                writer.WritePropertyName("supportingInfoSequence");
                writer.WriteStartArray();

                foreach (uint valSupportingInfoSequence in SupportingInfoSequence)
                {
                    writer.WriteNumberValue(valSupportingInfoSequence);
                }

                writer.WriteEndArray();
            }

            if (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (ProductOrService != null)
            {
                writer.WritePropertyName("productOrService");
                ProductOrService.SerializeJson(writer, options);
            }

            if ((Modifier != null) && (Modifier.Count != 0))
            {
                writer.WritePropertyName("modifier");
                writer.WriteStartArray();

                foreach (CodeableConcept valModifier in Modifier)
                {
                    valModifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Provider != null)
            {
                writer.WritePropertyName("provider");
                Provider.SerializeJson(writer, options);
            }

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.SerializeJson(writer, options);
            }

            if (UnitPrice != null)
            {
                writer.WritePropertyName("unitPrice");
                UnitPrice.SerializeJson(writer, options);
            }

            if (Facility != null)
            {
                writer.WritePropertyName("facility");
                Facility.SerializeJson(writer, options);
            }

            if ((Diagnosis != null) && (Diagnosis.Count != 0))
            {
                writer.WritePropertyName("diagnosis");
                writer.WriteStartArray();

                foreach (CoverageEligibilityRequestItemDiagnosis valDiagnosis in Diagnosis)
                {
                    valDiagnosis.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Detail != null) && (Detail.Count != 0))
            {
                writer.WritePropertyName("detail");
                writer.WriteStartArray();

                foreach (Reference valDetail in Detail)
                {
                    valDetail.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Type != null)
            {
                writer.WritePropertyName("type");
                Type.SerializeJson(writer, options);
            }

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.SerializeJson(writer, options);
            }

            if ((Material != null) && (Material.Count != 0))
            {
                writer.WritePropertyName("material");
                writer.WriteStartArray();

                foreach (CodeableConcept valMaterial in Material)
                {
                    valMaterial.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((AlternateMaterial != null) && (AlternateMaterial.Count != 0))
            {
                writer.WritePropertyName("alternateMaterial");
                writer.WriteStartArray();

                foreach (CodeableConcept valAlternateMaterial in AlternateMaterial)
                {
                    valAlternateMaterial.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Device != null) && (Device.Count != 0))
            {
                writer.WritePropertyName("device");
                writer.WriteStartArray();

                foreach (Reference valDevice in Device)
                {
                    valDevice.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ManufacturedItem != null) && (ManufacturedItem.Count != 0))
            {
                writer.WritePropertyName("manufacturedItem");
                writer.WriteStartArray();

                foreach (Reference valManufacturedItem in ManufacturedItem)
                {
                    valManufacturedItem.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((PackageItem != null) && (PackageItem.Count != 0))
            {
                writer.WritePropertyName("packageItem");
                writer.WriteStartArray();

                foreach (MedicinalProductPackagedPackageItem valPackageItem in PackageItem)
                {
                    valPackageItem.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (PhysicalCharacteristics != null)
            {
                writer.WritePropertyName("physicalCharacteristics");
                PhysicalCharacteristics.SerializeJson(writer, options);
            }

            if ((OtherCharacteristics != null) && (OtherCharacteristics.Count != 0))
            {
                writer.WritePropertyName("otherCharacteristics");
                writer.WriteStartArray();

                foreach (CodeableConcept valOtherCharacteristics in OtherCharacteristics)
                {
                    valOtherCharacteristics.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ShelfLifeStorage != null) && (ShelfLifeStorage.Count != 0))
            {
                writer.WritePropertyName("shelfLifeStorage");
                writer.WriteStartArray();

                foreach (ProductShelfLife valShelfLifeStorage in ShelfLifeStorage)
                {
                    valShelfLifeStorage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Manufacturer != null) && (Manufacturer.Count != 0))
            {
                writer.WritePropertyName("manufacturer");
                writer.WriteStartArray();

                foreach (Reference valManufacturer in Manufacturer)
                {
                    valManufacturer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Priority))
            {
                writer.WriteString("priority", (string)Priority !);
            }

            if (_Priority != null)
            {
                writer.WritePropertyName("_priority");
                _Priority.SerializeJson(writer, options);
            }

            if (ItemCodeableConcept != null)
            {
                writer.WritePropertyName("itemCodeableConcept");
                ItemCodeableConcept.SerializeJson(writer, options);
            }

            if (ItemReference != null)
            {
                writer.WritePropertyName("itemReference");
                ItemReference.SerializeJson(writer, options);
            }

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.SerializeJson(writer, options);
            }

            if ((Parameter != null) && (Parameter.Count != 0))
            {
                writer.WritePropertyName("parameter");
                writer.WriteStartArray();

                foreach (SupplyRequestParameter valParameter in Parameter)
                {
                    valParameter.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

            if (_OccurrenceDateTime != null)
            {
                writer.WritePropertyName("_occurrenceDateTime");
                _OccurrenceDateTime.SerializeJson(writer, options);
            }

            if (OccurrencePeriod != null)
            {
                writer.WritePropertyName("occurrencePeriod");
                OccurrencePeriod.SerializeJson(writer, options);
            }

            if (OccurrenceTiming != null)
            {
                writer.WritePropertyName("occurrenceTiming");
                OccurrenceTiming.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(AuthoredOn))
            {
                writer.WriteString("authoredOn", (string)AuthoredOn !);
            }

            if (_AuthoredOn != null)
            {
                writer.WritePropertyName("_authoredOn");
                _AuthoredOn.SerializeJson(writer, options);
            }

            if (Requester != null)
            {
                writer.WritePropertyName("requester");
                Requester.SerializeJson(writer, options);
            }

            if ((Supplier != null) && (Supplier.Count != 0))
            {
                writer.WritePropertyName("supplier");
                writer.WriteStartArray();

                foreach (Reference valSupplier in Supplier)
                {
                    valSupplier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReasonCode != null) && (ReasonCode.Count != 0))
            {
                writer.WritePropertyName("reasonCode");
                writer.WriteStartArray();

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReasonReference != null) && (ReasonReference.Count != 0))
            {
                writer.WritePropertyName("reasonReference");
                writer.WriteStartArray();

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (DeliverFrom != null)
            {
                writer.WritePropertyName("deliverFrom");
                DeliverFrom.SerializeJson(writer, options);
            }

            if (DeliverTo != null)
            {
                writer.WritePropertyName("deliverTo");
                DeliverTo.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if (ManufacturedDoseForm != null)
            {
                writer.WritePropertyName("manufacturedDoseForm");
                ManufacturedDoseForm.SerializeJson(writer, options);
            }

            if (UnitOfPresentation != null)
            {
                writer.WritePropertyName("unitOfPresentation");
                UnitOfPresentation.SerializeJson(writer, options);
            }

            if (Quantity != null)
            {
                writer.WritePropertyName("quantity");
                Quantity.SerializeJson(writer, options);
            }

            if ((Manufacturer != null) && (Manufacturer.Count != 0))
            {
                writer.WritePropertyName("manufacturer");
                writer.WriteStartArray();

                foreach (Reference valManufacturer in Manufacturer)
                {
                    valManufacturer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Ingredient != null) && (Ingredient.Count != 0))
            {
                writer.WritePropertyName("ingredient");
                writer.WriteStartArray();

                foreach (Reference valIngredient in Ingredient)
                {
                    valIngredient.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (PhysicalCharacteristics != null)
            {
                writer.WritePropertyName("physicalCharacteristics");
                PhysicalCharacteristics.SerializeJson(writer, options);
            }

            if ((OtherCharacteristics != null) && (OtherCharacteristics.Count != 0))
            {
                writer.WritePropertyName("otherCharacteristics");
                writer.WriteStartArray();

                foreach (CodeableConcept valOtherCharacteristics in OtherCharacteristics)
                {
                    valOtherCharacteristics.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }