Beispiel #1
0
        /// <summary>
        /// Deserialize JSON into a FHIR PaymentReconciliation#Notes
        /// </summary>
        public static void DeserializeJson(this PaymentReconciliation.NotesComponent 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($"PaymentReconciliation.NotesComponent >>> PaymentReconciliation#Notes.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"PaymentReconciliation.NotesComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
Beispiel #2
0
        /// <summary>
        /// Deserialize JSON into a FHIR PaymentReconciliation#Notes
        /// </summary>
        public static void DeserializeJsonProperty(this PaymentReconciliation.NotesComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "type":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.TypeElement = new Code <Hl7.Fhir.Model.NoteType>();
                    reader.Skip();
                }
                else
                {
                    current.TypeElement = new Code <Hl7.Fhir.Model.NoteType>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.NoteType>(reader.GetString()));
                }
                break;

            case "_type":
                if (current.TypeElement == null)
                {
                    current.TypeElement = new Code <Hl7.Fhir.Model.NoteType>();
                }
                ((Hl7.Fhir.Model.Element)current.TypeElement).DeserializeJson(ref reader, options);
                break;

            case "text":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.TextElement = new FhirString();
                    reader.Skip();
                }
                else
                {
                    current.TextElement = new FhirString(reader.GetString());
                }
                break;

            case "_text":
                if (current.TextElement == null)
                {
                    current.TextElement = new FhirString();
                }
                ((Hl7.Fhir.Model.Element)current.TextElement).DeserializeJson(ref reader, options);
                break;

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

            if (current.TypeElement != null)
            {
                if (current.TypeElement.Value != null)
                {
                    writer.WriteString("type", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.TypeElement.Value));
                }
                if (current.TypeElement.HasExtensions() || (!string.IsNullOrEmpty(current.TypeElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_type", false, current.TypeElement.Extension, current.TypeElement.ElementId);
                }
            }

            if (current.TextElement != null)
            {
                if (!string.IsNullOrEmpty(current.TextElement.Value))
                {
                    writer.WriteString("text", current.TextElement.Value);
                }
                if (current.TextElement.HasExtensions() || (!string.IsNullOrEmpty(current.TextElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_text", false, current.TextElement.Extension, current.TextElement.ElementId);
                }
            }

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