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

            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 (ActiveElement != null)
            {
                dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopy();
            }
            if (TypeElement != null)
            {
                dest.TypeElement = (Code <Hl7.Fhir.Model.Group.GroupType>)TypeElement.DeepCopy();
            }
            if (ActualElement != null)
            {
                dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopy();
            }
            if (Code != null)
            {
                dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
            }
            if (NameElement != null)
            {
                dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy();
            }
            if (QuantityElement != null)
            {
                dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopy();
            }
            if (ManagingEntity != null)
            {
                dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)ManagingEntity.DeepCopy();
            }
            if (Characteristic != null)
            {
                dest.Characteristic = new List <Hl7.Fhir.Model.Group.CharacteristicComponent>(Characteristic.DeepCopy());
            }
            if (Member != null)
            {
                dest.Member = new List <Hl7.Fhir.Model.Group.MemberComponent>(Member.DeepCopy());
            }
            return(dest);
        }
コード例 #2
0
ファイル: Group.cs プロジェクト: microsoft/fhir-codegen
        /// <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 (Active != null)
            {
                writer.WriteBoolean("active", (bool)Active !);
            }

            if (!string.IsNullOrEmpty(Type))
            {
                writer.WriteString("type", (string)Type !);
            }

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

            writer.WriteBoolean("actual", Actual);

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

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

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

            if (Quantity != null)
            {
                writer.WriteNumber("quantity", (uint)Quantity !);
            }

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

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

                foreach (GroupCharacteristic valCharacteristic in Characteristic)
                {
                    valCharacteristic.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (GroupMember valMember in Member)
                {
                    valMember.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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