public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ResearchStudy; 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 (TitleElement != null) { dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy(); } if (Protocol != null) { dest.Protocol = new List <Hl7.Fhir.Model.ResourceReference>(Protocol.DeepCopy()); } if (PartOf != null) { dest.PartOf = new List <Hl7.Fhir.Model.ResourceReference>(PartOf.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus>)StatusElement.DeepCopy(); } if (Category != null) { dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy()); } if (Focus != null) { dest.Focus = new List <Hl7.Fhir.Model.CodeableConcept>(Focus.DeepCopy()); } if (Contact != null) { dest.Contact = new List <Hl7.Fhir.Model.ContactDetail>(Contact.DeepCopy()); } if (RelatedArtifact != null) { dest.RelatedArtifact = new List <Hl7.Fhir.Model.RelatedArtifact>(RelatedArtifact.DeepCopy()); } if (Keyword != null) { dest.Keyword = new List <Hl7.Fhir.Model.CodeableConcept>(Keyword.DeepCopy()); } if (Jurisdiction != null) { dest.Jurisdiction = new List <Hl7.Fhir.Model.CodeableConcept>(Jurisdiction.DeepCopy()); } if (Description != null) { dest.Description = (Hl7.Fhir.Model.Markdown)Description.DeepCopy(); } if (Enrollment != null) { dest.Enrollment = new List <Hl7.Fhir.Model.ResourceReference>(Enrollment.DeepCopy()); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (Sponsor != null) { dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)Sponsor.DeepCopy(); } if (PrincipalInvestigator != null) { dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)PrincipalInvestigator.DeepCopy(); } if (Site != null) { dest.Site = new List <Hl7.Fhir.Model.ResourceReference>(Site.DeepCopy()); } if (ReasonStopped != null) { dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)ReasonStopped.DeepCopy(); } if (Note != null) { dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy()); } if (Arm != null) { dest.Arm = new List <Hl7.Fhir.Model.ResearchStudy.ArmComponent>(Arm.DeepCopy()); } return(dest); }
/// <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(Title)) { writer.WriteString("title", (string)Title !); } if (_Title != null) { writer.WritePropertyName("_title"); _Title.SerializeJson(writer, options); } if ((Protocol != null) && (Protocol.Count != 0)) { writer.WritePropertyName("protocol"); writer.WriteStartArray(); foreach (Reference valProtocol in Protocol) { valProtocol.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((PartOf != null) && (PartOf.Count != 0)) { writer.WritePropertyName("partOf"); writer.WriteStartArray(); foreach (Reference valPartOf in PartOf) { valPartOf.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 (PrimaryPurposeType != null) { writer.WritePropertyName("primaryPurposeType"); PrimaryPurposeType.SerializeJson(writer, options); } if (Phase != null) { writer.WritePropertyName("phase"); Phase.SerializeJson(writer, options); } if ((Category != null) && (Category.Count != 0)) { writer.WritePropertyName("category"); writer.WriteStartArray(); foreach (CodeableConcept valCategory in Category) { valCategory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Focus != null) && (Focus.Count != 0)) { writer.WritePropertyName("focus"); writer.WriteStartArray(); foreach (CodeableConcept valFocus in Focus) { valFocus.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Condition != null) && (Condition.Count != 0)) { writer.WritePropertyName("condition"); writer.WriteStartArray(); foreach (CodeableConcept valCondition in Condition) { valCondition.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Contact != null) && (Contact.Count != 0)) { writer.WritePropertyName("contact"); writer.WriteStartArray(); foreach (ContactDetail valContact in Contact) { valContact.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((RelatedArtifact != null) && (RelatedArtifact.Count != 0)) { writer.WritePropertyName("relatedArtifact"); writer.WriteStartArray(); foreach (RelatedArtifact valRelatedArtifact in RelatedArtifact) { valRelatedArtifact.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Keyword != null) && (Keyword.Count != 0)) { writer.WritePropertyName("keyword"); writer.WriteStartArray(); foreach (CodeableConcept valKeyword in Keyword) { valKeyword.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Location != null) && (Location.Count != 0)) { writer.WritePropertyName("location"); writer.WriteStartArray(); foreach (CodeableConcept valLocation in Location) { valLocation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Description)) { writer.WriteString("description", (string)Description !); } if (_Description != null) { writer.WritePropertyName("_description"); _Description.SerializeJson(writer, options); } if ((Enrollment != null) && (Enrollment.Count != 0)) { writer.WritePropertyName("enrollment"); writer.WriteStartArray(); foreach (Reference valEnrollment in Enrollment) { valEnrollment.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Period != null) { writer.WritePropertyName("period"); Period.SerializeJson(writer, options); } if (Sponsor != null) { writer.WritePropertyName("sponsor"); Sponsor.SerializeJson(writer, options); } if (PrincipalInvestigator != null) { writer.WritePropertyName("principalInvestigator"); PrincipalInvestigator.SerializeJson(writer, options); } if ((Site != null) && (Site.Count != 0)) { writer.WritePropertyName("site"); writer.WriteStartArray(); foreach (Reference valSite in Site) { valSite.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (ReasonStopped != null) { writer.WritePropertyName("reasonStopped"); ReasonStopped.SerializeJson(writer, options); } if ((Note != null) && (Note.Count != 0)) { writer.WritePropertyName("note"); writer.WriteStartArray(); foreach (Annotation valNote in Note) { valNote.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Arm != null) && (Arm.Count != 0)) { writer.WritePropertyName("arm"); writer.WriteStartArray(); foreach (ResearchStudyArm valArm in Arm) { valArm.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Objective != null) && (Objective.Count != 0)) { writer.WritePropertyName("objective"); writer.WriteStartArray(); foreach (ResearchStudyObjective valObjective in Objective) { valObjective.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }