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

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

            base.CopyTo(dest);
            if (SequenceType != null)
            {
                dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)SequenceType.DeepCopy();
            }
            if (NumberOfSubunitsElement != null)
            {
                dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)NumberOfSubunitsElement.DeepCopy();
            }
            if (AreaOfHybridisationElement != null)
            {
                dest.AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)AreaOfHybridisationElement.DeepCopy();
            }
            if (OligoNucleotideType != null)
            {
                dest.OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)OligoNucleotideType.DeepCopy();
            }
            if (Subunit != null)
            {
                dest.Subunit = new List <Hl7.Fhir.Model.SubstanceNucleicAcid.SubunitComponent>(Subunit.DeepCopy());
            }
            return(dest);
        }
Example #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 !);
            }


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

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

            if (NumberOfSubunits != null)
            {
                writer.WriteNumber("numberOfSubunits", (int)NumberOfSubunits !);
            }

            if (!string.IsNullOrEmpty(AreaOfHybridisation))
            {
                writer.WriteString("areaOfHybridisation", (string)AreaOfHybridisation !);
            }

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

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

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

                foreach (SubstanceNucleicAcidSubunit valSubunit in Subunit)
                {
                    valSubunit.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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