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

            throw new JsonException($"DocumentManifest.RelatedComponent: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
示例#2
0
        /// <summary>
        /// Serialize a FHIR DocumentManifest#Related into JSON
        /// </summary>
        public static void SerializeJson(this DocumentManifest.RelatedComponent current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Component: DocumentManifest#Related, Export: RelatedComponent, Base: BackboneElement (BackboneElement)
            ((Hl7.Fhir.Model.BackboneElement)current).SerializeJson(writer, options, false);

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

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#3
0
        /// <summary>
        /// Deserialize JSON into a FHIR DocumentManifest#Related
        /// </summary>
        public static void DeserializeJsonProperty(this DocumentManifest.RelatedComponent current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                current.Identifier = new Hl7.Fhir.Model.Identifier();
                ((Hl7.Fhir.Model.Identifier)current.Identifier).DeserializeJson(ref reader, options);
                break;

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

            // Complex: related, Export: RelatedComponent, Base: BackboneElement
            default:
                ((Hl7.Fhir.Model.BackboneElement)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }