Exemple #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Evidence;

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

            base.CopyTo(dest);
            if (UrlElement != null)
            {
                dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (VersionElement != null)
            {
                dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (TitleElement != null)
            {
                dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopy();
            }
            if (ShortTitleElement != null)
            {
                dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopy();
            }
            if (SubtitleElement != null)
            {
                dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.PublicationStatus>)StatusElement.DeepCopy();
            }
            if (DateElement != null)
            {
                dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopy();
            }
            if (PublisherElement != null)
            {
                dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopy();
            }
            if (Contact != null)
            {
                dest.Contact = new List <Hl7.Fhir.Model.ContactDetail>(Contact.DeepCopy());
            }
            if (Description != null)
            {
                dest.Description = (Hl7.Fhir.Model.Markdown)Description.DeepCopy();
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (UseContext != null)
            {
                dest.UseContext = new List <Hl7.Fhir.Model.UsageContext>(UseContext.DeepCopy());
            }
            if (Jurisdiction != null)
            {
                dest.Jurisdiction = new List <Hl7.Fhir.Model.CodeableConcept>(Jurisdiction.DeepCopy());
            }
            if (Copyright != null)
            {
                dest.Copyright = (Hl7.Fhir.Model.Markdown)Copyright.DeepCopy();
            }
            if (ApprovalDateElement != null)
            {
                dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopy();
            }
            if (LastReviewDateElement != null)
            {
                dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopy();
            }
            if (EffectivePeriod != null)
            {
                dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopy();
            }
            if (Topic != null)
            {
                dest.Topic = new List <Hl7.Fhir.Model.CodeableConcept>(Topic.DeepCopy());
            }
            if (Author != null)
            {
                dest.Author = new List <Hl7.Fhir.Model.ContactDetail>(Author.DeepCopy());
            }
            if (Editor != null)
            {
                dest.Editor = new List <Hl7.Fhir.Model.ContactDetail>(Editor.DeepCopy());
            }
            if (Reviewer != null)
            {
                dest.Reviewer = new List <Hl7.Fhir.Model.ContactDetail>(Reviewer.DeepCopy());
            }
            if (Endorser != null)
            {
                dest.Endorser = new List <Hl7.Fhir.Model.ContactDetail>(Endorser.DeepCopy());
            }
            if (RelatedArtifact != null)
            {
                dest.RelatedArtifact = new List <Hl7.Fhir.Model.RelatedArtifact>(RelatedArtifact.DeepCopy());
            }
            if (ExposureBackground != null)
            {
                dest.ExposureBackground = (Hl7.Fhir.Model.ResourceReference)ExposureBackground.DeepCopy();
            }
            if (ExposureVariant != null)
            {
                dest.ExposureVariant = new List <Hl7.Fhir.Model.ResourceReference>(ExposureVariant.DeepCopy());
            }
            if (Outcome != null)
            {
                dest.Outcome = new List <Hl7.Fhir.Model.ResourceReference>(Outcome.DeepCopy());
            }
            return(dest);
        }
Exemple #2
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 (!string.IsNullOrEmpty(Url))
            {
                writer.WriteString("url", (string)Url !);
            }

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

            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(Version))
            {
                writer.WriteString("version", (string)Version !);
            }

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

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

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

            if (!string.IsNullOrEmpty(Title))
            {
                writer.WriteString("title", (string)Title !);
            }

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

            if (!string.IsNullOrEmpty(ShortTitle))
            {
                writer.WriteString("shortTitle", (string)ShortTitle !);
            }

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

            if (!string.IsNullOrEmpty(Subtitle))
            {
                writer.WriteString("subtitle", (string)Subtitle !);
            }

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

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

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

            if (!string.IsNullOrEmpty(Date))
            {
                writer.WriteString("date", (string)Date !);
            }

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

            if (!string.IsNullOrEmpty(Publisher))
            {
                writer.WriteString("publisher", (string)Publisher !);
            }

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

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

                foreach (ContactDetail valContact in Contact)
                {
                    valContact.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 ((Note != null) && (Note.Count != 0))
            {
                writer.WritePropertyName("note");
                writer.WriteStartArray();

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (UsageContext valUseContext in UseContext)
                {
                    valUseContext.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valJurisdiction in Jurisdiction)
                {
                    valJurisdiction.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Copyright))
            {
                writer.WriteString("copyright", (string)Copyright !);
            }

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

            if (!string.IsNullOrEmpty(ApprovalDate))
            {
                writer.WriteString("approvalDate", (string)ApprovalDate !);
            }

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

            if (!string.IsNullOrEmpty(LastReviewDate))
            {
                writer.WriteString("lastReviewDate", (string)LastReviewDate !);
            }

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

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

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

                foreach (CodeableConcept valTopic in Topic)
                {
                    valTopic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valAuthor in Author)
                {
                    valAuthor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEditor in Editor)
                {
                    valEditor.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valReviewer in Reviewer)
                {
                    valReviewer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (ContactDetail valEndorser in Endorser)
                {
                    valEndorser.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 (ExposureBackground != null)
            {
                writer.WritePropertyName("exposureBackground");
                ExposureBackground.SerializeJson(writer, options);
            }

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

                foreach (Reference valExposureVariant in ExposureVariant)
                {
                    valExposureVariant.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valOutcome in Outcome)
                {
                    valOutcome.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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