Esempio n. 1
0
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (Identifier != null)
                {
                    Identifier.ForEach(elem => result.AddRange(elem.Validate()));
                }
                if (DescriptionElement != null)
                {
                    result.AddRange(DescriptionElement.Validate());
                }
                if (Type != null)
                {
                    result.AddRange(Type.Validate());
                }
                if (Capacity != null)
                {
                    result.AddRange(Capacity.Validate());
                }
                if (SpecimenQuantity != null)
                {
                    result.AddRange(SpecimenQuantity.Validate());
                }
                if (Additive != null)
                {
                    result.AddRange(Additive.Validate());
                }

                return(result);
            }
Esempio n. 2
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as ContainerComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Identifier != null)
                    {
                        dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                    }
                    if (DescriptionElement != null)
                    {
                        dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                    }
                    if (Type != null)
                    {
                        dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                    }
                    if (Capacity != null)
                    {
                        dest.Capacity = (Hl7.Fhir.Model.SimpleQuantity)Capacity.DeepCopy();
                    }
                    if (SpecimenQuantity != null)
                    {
                        dest.SpecimenQuantity = (Hl7.Fhir.Model.SimpleQuantity)SpecimenQuantity.DeepCopy();
                    }
                    if (Additive != null)
                    {
                        dest.Additive = (Hl7.Fhir.Model.Element)Additive.DeepCopy();
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
Esempio n. 3
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 ((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(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

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

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

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

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

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

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

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