Esempio n. 1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as ProdCharacteristic;

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

            base.CopyTo(dest);
            if (Height != null)
            {
                dest.Height = (Hl7.Fhir.Model.Quantity)Height.DeepCopy();
            }
            if (Width != null)
            {
                dest.Width = (Hl7.Fhir.Model.Quantity)Width.DeepCopy();
            }
            if (Depth != null)
            {
                dest.Depth = (Hl7.Fhir.Model.Quantity)Depth.DeepCopy();
            }
            if (Weight != null)
            {
                dest.Weight = (Hl7.Fhir.Model.Quantity)Weight.DeepCopy();
            }
            if (NominalVolume != null)
            {
                dest.NominalVolume = (Hl7.Fhir.Model.Quantity)NominalVolume.DeepCopy();
            }
            if (ExternalDiameter != null)
            {
                dest.ExternalDiameter = (Hl7.Fhir.Model.Quantity)ExternalDiameter.DeepCopy();
            }
            if (ShapeElement != null)
            {
                dest.ShapeElement = (Hl7.Fhir.Model.FhirString)ShapeElement.DeepCopy();
            }
            if (ColorElement != null)
            {
                dest.ColorElement = new List <Hl7.Fhir.Model.FhirString>(ColorElement.DeepCopy());
            }
            if (ImprintElement != null)
            {
                dest.ImprintElement = new List <Hl7.Fhir.Model.FhirString>(ImprintElement.DeepCopy());
            }
            if (Image != null)
            {
                dest.Image = new List <Hl7.Fhir.Model.Attachment>(Image.DeepCopy());
            }
            if (Scoring != null)
            {
                dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopy();
            }
            return(dest);
        }
Esempio n. 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 (Height != null)
            {
                writer.WritePropertyName("height");
                Height.SerializeJson(writer, options);
            }

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

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

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

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

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

            if (!string.IsNullOrEmpty(Shape))
            {
                writer.WriteString("shape", (string)Shape !);
            }

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

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

                foreach (string valColor in Color)
                {
                    writer.WriteStringValue(valColor);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Color in _Color)
                {
                    val_Color.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valImprint in Imprint)
                {
                    writer.WriteStringValue(valImprint);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_Imprint in _Imprint)
                {
                    val_Imprint.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Attachment valImage in Image)
                {
                    valImage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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