public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicinalProductManufactured;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (ManufacturedDoseForm != null)
            {
                dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)ManufacturedDoseForm.DeepCopy();
            }
            if (UnitOfPresentation != null)
            {
                dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopy();
            }
            if (Quantity != null)
            {
                dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopy();
            }
            if (Manufacturer != null)
            {
                dest.Manufacturer = new List <Hl7.Fhir.Model.ResourceReference>(Manufacturer.DeepCopy());
            }
            if (Ingredient != null)
            {
                dest.Ingredient = new List <Hl7.Fhir.Model.ResourceReference>(Ingredient.DeepCopy());
            }
            if (PhysicalCharacteristics != null)
            {
                dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)PhysicalCharacteristics.DeepCopy();
            }
            if (OtherCharacteristics != null)
            {
                dest.OtherCharacteristics = new List <Hl7.Fhir.Model.CodeableConcept>(OtherCharacteristics.DeepCopy());
            }
            return(dest);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as ManufacturedItemDefinition;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (ManufacturedDoseForm != null)
            {
                dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)ManufacturedDoseForm.DeepCopy();
            }
            if (UnitOfPresentation != null)
            {
                dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopy();
            }
            if (Manufacturer != null)
            {
                dest.Manufacturer = new List <Hl7.Fhir.Model.ResourceReference>(Manufacturer.DeepCopy());
            }
            if (Ingredient != null)
            {
                dest.Ingredient = new List <Hl7.Fhir.Model.ResourceReference>(Ingredient.DeepCopy());
            }
            if (Property != null)
            {
                dest.Property = new List <Hl7.Fhir.Model.ManufacturedItemDefinition.PropertyComponent>(Property.DeepCopy());
            }
            return(dest);
        }
Ejemplo n.º 3
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 !);
            }


            ((Fhir.R4.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();
            }
        }