Exemple #1
0
        /// <summary>
        /// Deserialize JSON into a FHIR MedicationAdministration#Performer
        /// </summary>
        public static void DeserializeJson(this MedicationAdministration.PerformerComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"MedicationAdministration.PerformerComponent >>> MedicationAdministration#Performer.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"MedicationAdministration.PerformerComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
Exemple #2
0
        /// <summary>
        /// Deserialize JSON into a FHIR MedicationAdministration#Performer
        /// </summary>
        public static void DeserializeJsonProperty(this MedicationAdministration.PerformerComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "function":
                current.Function = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Function).DeserializeJson(ref reader, options);
                break;

            case "actor":
                current.Actor = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Actor).DeserializeJson(ref reader, options);
                break;

            // Complex: performer, Export: PerformerComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Exemple #3
0
        /// <summary>
        /// Serialize a FHIR MedicationAdministration#Performer into JSON
        /// </summary>
        public static void SerializeJson(this MedicationAdministration.PerformerComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Component: MedicationAdministration#Performer, Export: PerformerComponent, Base: BackboneElement (BackboneElement)
            ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false);

            if (current.Function != null)
            {
                writer.WritePropertyName("function");
                current.Function.SerializeJson(writer, options);
            }

            writer.WritePropertyName("actor");
            current.Actor.SerializeJson(writer, options);

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