コード例 #1
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as RouteOfAdministrationComponent;

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

                base.CopyTo(dest);
                if (Code != null)
                {
                    dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
                }
                if (FirstDose != null)
                {
                    dest.FirstDose = (Hl7.Fhir.Model.Quantity)FirstDose.DeepCopy();
                }
                if (MaxSingleDose != null)
                {
                    dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)MaxSingleDose.DeepCopy();
                }
                if (MaxDosePerDay != null)
                {
                    dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)MaxDosePerDay.DeepCopy();
                }
                if (MaxDosePerTreatmentPeriod != null)
                {
                    dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerTreatmentPeriod.DeepCopy();
                }
                if (MaxTreatmentPeriod != null)
                {
                    dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)MaxTreatmentPeriod.DeepCopy();
                }
                if (TargetSpecies != null)
                {
                    dest.TargetSpecies = new List <Hl7.Fhir.Model.MedicinalProductPharmaceutical.TargetSpeciesComponent>(TargetSpecies.DeepCopy());
                }
                return(dest);
            }
コード例 #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 (Code != null)
            {
                writer.WritePropertyName("code");
                Code.SerializeJson(writer, options);
            }

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

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

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

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

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

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

                foreach (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpecies valTargetSpecies in TargetSpecies)
                {
                    valTargetSpecies.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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