Пример #1
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "action":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Action = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objAction = new fhirCsR4.Models.CodeableConcept();
                    objAction.DeserializeJson(ref reader, options);
                    Action.Add(objAction);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Action.Count == 0)
                {
                    Action = null;
                }

                break;

            case "actor":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Actor = new List <ConsentProvisionActor>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConsentProvisionActor objActor = new fhirCsR4.Models.ConsentProvisionActor();
                    objActor.DeserializeJson(ref reader, options);
                    Actor.Add(objActor);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Actor.Count == 0)
                {
                    Actor = null;
                }

                break;

            case "class":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Class = new List <Coding>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Coding objClass = new fhirCsR4.Models.Coding();
                    objClass.DeserializeJson(ref reader, options);
                    Class.Add(objClass);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Class.Count == 0)
                {
                    Class = null;
                }

                break;

            case "code":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Code = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCode = new fhirCsR4.Models.CodeableConcept();
                    objCode.DeserializeJson(ref reader, options);
                    Code.Add(objCode);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Code.Count == 0)
                {
                    Code = null;
                }

                break;

            case "data":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Data = new List <ConsentProvisionData>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConsentProvisionData objData = new fhirCsR4.Models.ConsentProvisionData();
                    objData.DeserializeJson(ref reader, options);
                    Data.Add(objData);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Data.Count == 0)
                {
                    Data = null;
                }

                break;

            case "dataPeriod":
                DataPeriod = new fhirCsR4.Models.Period();
                DataPeriod.DeserializeJson(ref reader, options);
                break;

            case "period":
                Period = new fhirCsR4.Models.Period();
                Period.DeserializeJson(ref reader, options);
                break;

            case "provision":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Provision = new List <ConsentProvision>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConsentProvision objProvision = new fhirCsR4.Models.ConsentProvision();
                    objProvision.DeserializeJson(ref reader, options);
                    Provision.Add(objProvision);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Provision.Count == 0)
                {
                    Provision = null;
                }

                break;

            case "purpose":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Purpose = new List <Coding>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Coding objPurpose = new fhirCsR4.Models.Coding();
                    objPurpose.DeserializeJson(ref reader, options);
                    Purpose.Add(objPurpose);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Purpose.Count == 0)
                {
                    Purpose = null;
                }

                break;

            case "securityLabel":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                SecurityLabel = new List <Coding>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Coding objSecurityLabel = new fhirCsR4.Models.Coding();
                    objSecurityLabel.DeserializeJson(ref reader, options);
                    SecurityLabel.Add(objSecurityLabel);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (SecurityLabel.Count == 0)
                {
                    SecurityLabel = null;
                }

                break;

            case "type":
                Type = reader.GetString();
                break;

            case "_type":
                _Type = new fhirCsR4.Models.Element();
                _Type.DeserializeJson(ref reader, options);
                break;

            default:
                ((fhirCsR4.Models.BackboneElement) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Deserialize a JSON property
        /// </summary>
        public new void DeserializeJsonProperty(ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "category":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Category = new List <CodeableConcept>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.CodeableConcept objCategory = new fhirCsR4.Models.CodeableConcept();
                    objCategory.DeserializeJson(ref reader, options);
                    Category.Add(objCategory);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Category.Count == 0)
                {
                    Category = null;
                }

                break;

            case "dateTime":
                DateTime = reader.GetString();
                break;

            case "_dateTime":
                _DateTime = new fhirCsR4.Models.Element();
                _DateTime.DeserializeJson(ref reader, options);
                break;

            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Identifier objIdentifier = new fhirCsR4.Models.Identifier();
                    objIdentifier.DeserializeJson(ref reader, options);
                    Identifier.Add(objIdentifier);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Identifier.Count == 0)
                {
                    Identifier = null;
                }

                break;

            case "organization":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Organization = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objOrganization = new fhirCsR4.Models.Reference();
                    objOrganization.DeserializeJson(ref reader, options);
                    Organization.Add(objOrganization);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Organization.Count == 0)
                {
                    Organization = null;
                }

                break;

            case "patient":
                Patient = new fhirCsR4.Models.Reference();
                Patient.DeserializeJson(ref reader, options);
                break;

            case "performer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Performer = new List <Reference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.Reference objPerformer = new fhirCsR4.Models.Reference();
                    objPerformer.DeserializeJson(ref reader, options);
                    Performer.Add(objPerformer);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Performer.Count == 0)
                {
                    Performer = null;
                }

                break;

            case "policy":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Policy = new List <ConsentPolicy>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConsentPolicy objPolicy = new fhirCsR4.Models.ConsentPolicy();
                    objPolicy.DeserializeJson(ref reader, options);
                    Policy.Add(objPolicy);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Policy.Count == 0)
                {
                    Policy = null;
                }

                break;

            case "policyRule":
                PolicyRule = new fhirCsR4.Models.CodeableConcept();
                PolicyRule.DeserializeJson(ref reader, options);
                break;

            case "provision":
                Provision = new fhirCsR4.Models.ConsentProvision();
                Provision.DeserializeJson(ref reader, options);
                break;

            case "scope":
                Scope = new fhirCsR4.Models.CodeableConcept();
                Scope.DeserializeJson(ref reader, options);
                break;

            case "sourceAttachment":
                SourceAttachment = new fhirCsR4.Models.Attachment();
                SourceAttachment.DeserializeJson(ref reader, options);
                break;

            case "sourceReference":
                SourceReference = new fhirCsR4.Models.Reference();
                SourceReference.DeserializeJson(ref reader, options);
                break;

            case "status":
                Status = reader.GetString();
                break;

            case "_status":
                _Status = new fhirCsR4.Models.Element();
                _Status.DeserializeJson(ref reader, options);
                break;

            case "verification":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException();
                }

                Verification = new List <ConsentVerification>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    fhirCsR4.Models.ConsentVerification objVerification = new fhirCsR4.Models.ConsentVerification();
                    objVerification.DeserializeJson(ref reader, options);
                    Verification.Add(objVerification);

                    if (!reader.Read())
                    {
                        throw new JsonException();
                    }
                }

                if (Verification.Count == 0)
                {
                    Verification = null;
                }

                break;

            default:
                ((fhirCsR4.Models.DomainResource) this).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }