Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding IReadOnlyDictionary support (for R3) #1816

2 changes: 1 addition & 1 deletion common
113 changes: 113 additions & 0 deletions src/Hl7.Fhir.Core/Model/Generated/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,29 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "coverage":
value = Coverage;
return Coverage is not null;
case "priority":
value = PriorityElement;
return PriorityElement is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Coverage is not null) yield return new KeyValuePair<string,object>("coverage",Coverage);
if (PriorityElement is not null) yield return new KeyValuePair<string,object>("priority",PriorityElement);
}

}

/// <summary>
Expand Down Expand Up @@ -355,6 +378,33 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "party":
value = Party;
return Party is not null;
case "onHold":
value = OnHoldElement;
return OnHoldElement is not null;
case "period":
value = Period;
return Period is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Party is not null) yield return new KeyValuePair<string,object>("party",Party);
if (OnHoldElement is not null) yield return new KeyValuePair<string,object>("onHold",OnHoldElement);
if (Period is not null) yield return new KeyValuePair<string,object>("period",Period);
}

}

/// <summary>
Expand Down Expand Up @@ -691,6 +741,69 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "identifier":
value = Identifier;
return Identifier?.Any() == true;
case "status":
value = StatusElement;
return StatusElement is not null;
case "type":
value = Type;
return Type is not null;
case "name":
value = NameElement;
return NameElement is not null;
case "subject":
value = Subject;
return Subject is not null;
case "period":
value = Period;
return Period is not null;
case "active":
value = Active;
return Active is not null;
case "balance":
value = Balance;
return Balance is not null;
case "coverage":
value = Coverage;
return Coverage?.Any() == true;
case "owner":
value = Owner;
return Owner is not null;
case "description":
value = DescriptionElement;
return DescriptionElement is not null;
case "guarantor":
value = Guarantor;
return Guarantor?.Any() == true;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (Identifier?.Any() == true) yield return new KeyValuePair<string,object>("identifier",Identifier);
if (StatusElement is not null) yield return new KeyValuePair<string,object>("status",StatusElement);
if (Type is not null) yield return new KeyValuePair<string,object>("type",Type);
if (NameElement is not null) yield return new KeyValuePair<string,object>("name",NameElement);
if (Subject is not null) yield return new KeyValuePair<string,object>("subject",Subject);
if (Period is not null) yield return new KeyValuePair<string,object>("period",Period);
if (Active is not null) yield return new KeyValuePair<string,object>("active",Active);
if (Balance is not null) yield return new KeyValuePair<string,object>("balance",Balance);
if (Coverage?.Any() == true) yield return new KeyValuePair<string,object>("coverage",Coverage);
if (Owner is not null) yield return new KeyValuePair<string,object>("owner",Owner);
if (DescriptionElement is not null) yield return new KeyValuePair<string,object>("description",DescriptionElement);
if (Guarantor?.Any() == true) yield return new KeyValuePair<string,object>("guarantor",Guarantor);
}

}

}
Expand Down
220 changes: 220 additions & 0 deletions src/Hl7.Fhir.Core/Model/Generated/ActivityDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "type":
value = TypeElement;
return TypeElement is not null;
case "role":
value = Role;
return Role is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (TypeElement is not null) yield return new KeyValuePair<string,object>("type",TypeElement);
if (Role is not null) yield return new KeyValuePair<string,object>("role",Role);
}

}

/// <summary>
Expand Down Expand Up @@ -395,6 +418,37 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "description":
value = DescriptionElement;
return DescriptionElement is not null;
case "path":
value = PathElement;
return PathElement is not null;
case "language":
value = LanguageElement;
return LanguageElement is not null;
case "expression":
value = ExpressionElement;
return ExpressionElement is not null;
default:
return base.TryGetValue(key, out value);
};

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (DescriptionElement is not null) yield return new KeyValuePair<string,object>("description",DescriptionElement);
if (PathElement is not null) yield return new KeyValuePair<string,object>("path",PathElement);
if (LanguageElement is not null) yield return new KeyValuePair<string,object>("language",LanguageElement);
if (ExpressionElement is not null) yield return new KeyValuePair<string,object>("expression",ExpressionElement);
}

}

/// <summary>
Expand Down Expand Up @@ -1307,6 +1361,172 @@ public override IEnumerable<ElementValue> NamedChildren
}
}

protected override bool TryGetValue(string key, out object value)
{
switch (key)
{
case "url":
value = UrlElement;
return UrlElement is not null;
case "identifier":
value = Identifier;
return Identifier?.Any() == true;
case "version":
value = VersionElement;
return VersionElement is not null;
case "name":
value = NameElement;
return NameElement is not null;
case "title":
value = TitleElement;
return TitleElement is not null;
case "status":
value = StatusElement;
return StatusElement is not null;
case "experimental":
value = ExperimentalElement;
return ExperimentalElement is not null;
case "date":
value = DateElement;
return DateElement is not null;
case "publisher":
value = PublisherElement;
return PublisherElement is not null;
case "description":
value = Description;
return Description is not null;
case "purpose":
value = Purpose;
return Purpose is not null;
case "usage":
value = UsageElement;
return UsageElement is not null;
case "approvalDate":
value = ApprovalDateElement;
return ApprovalDateElement is not null;
case "lastReviewDate":
value = LastReviewDateElement;
return LastReviewDateElement is not null;
case "effectivePeriod":
value = EffectivePeriod;
return EffectivePeriod is not null;
case "useContext":
value = UseContext;
return UseContext?.Any() == true;
case "jurisdiction":
value = Jurisdiction;
return Jurisdiction?.Any() == true;
case "topic":
value = Topic;
return Topic?.Any() == true;
case "contributor":
value = Contributor;
return Contributor?.Any() == true;
case "contact":
value = Contact;
return Contact?.Any() == true;
case "copyright":
value = Copyright;
return Copyright is not null;
case "relatedArtifact":
value = RelatedArtifact;
return RelatedArtifact?.Any() == true;
case "library":
value = Library;
return Library?.Any() == true;
case "kind":
value = KindElement;
return KindElement is not null;
case "code":
value = Code;
return Code is not null;
case "timing":
value = Timing;
return Timing is not null;
case "location":
value = Location;
return Location is not null;
case "participant":
value = Participant;
return Participant?.Any() == true;
case "product":
value = Product;
return Product is not null;
case "quantity":
value = Quantity;
return Quantity is not null;
case "dosage":
value = Dosage;
return Dosage?.Any() == true;
case "bodySite":
value = BodySite;
return BodySite?.Any() == true;
case "transform":
value = Transform;
return Transform is not null;
case "dynamicValue":
value = DynamicValue;
return DynamicValue?.Any() == true;
default:
return choiceMatches(out value);
};

bool choiceMatches(out object value)
{
if (key.StartsWith("timing"))
{
value = Timing;
return Timing is not null && PocoDictionary.HasCorrectSuffix(key, Timing.TypeName, 6);
}
else if (key.StartsWith("product"))
{
value = Product;
return Product is not null && PocoDictionary.HasCorrectSuffix(key, Product.TypeName, 7);
}
return base.TryGetValue(key, out value);
}

}

protected override IEnumerable<KeyValuePair<string, object>> GetElementPairs()
{
foreach (var kvp in base.GetElementPairs()) yield return kvp;
if (UrlElement is not null) yield return new KeyValuePair<string,object>("url",UrlElement);
if (Identifier?.Any() == true) yield return new KeyValuePair<string,object>("identifier",Identifier);
if (VersionElement is not null) yield return new KeyValuePair<string,object>("version",VersionElement);
if (NameElement is not null) yield return new KeyValuePair<string,object>("name",NameElement);
if (TitleElement is not null) yield return new KeyValuePair<string,object>("title",TitleElement);
if (StatusElement is not null) yield return new KeyValuePair<string,object>("status",StatusElement);
if (ExperimentalElement is not null) yield return new KeyValuePair<string,object>("experimental",ExperimentalElement);
if (DateElement is not null) yield return new KeyValuePair<string,object>("date",DateElement);
if (PublisherElement is not null) yield return new KeyValuePair<string,object>("publisher",PublisherElement);
if (Description is not null) yield return new KeyValuePair<string,object>("description",Description);
if (Purpose is not null) yield return new KeyValuePair<string,object>("purpose",Purpose);
if (UsageElement is not null) yield return new KeyValuePair<string,object>("usage",UsageElement);
if (ApprovalDateElement is not null) yield return new KeyValuePair<string,object>("approvalDate",ApprovalDateElement);
if (LastReviewDateElement is not null) yield return new KeyValuePair<string,object>("lastReviewDate",LastReviewDateElement);
if (EffectivePeriod is not null) yield return new KeyValuePair<string,object>("effectivePeriod",EffectivePeriod);
if (UseContext?.Any() == true) yield return new KeyValuePair<string,object>("useContext",UseContext);
if (Jurisdiction?.Any() == true) yield return new KeyValuePair<string,object>("jurisdiction",Jurisdiction);
if (Topic?.Any() == true) yield return new KeyValuePair<string,object>("topic",Topic);
if (Contributor?.Any() == true) yield return new KeyValuePair<string,object>("contributor",Contributor);
if (Contact?.Any() == true) yield return new KeyValuePair<string,object>("contact",Contact);
if (Copyright is not null) yield return new KeyValuePair<string,object>("copyright",Copyright);
if (RelatedArtifact?.Any() == true) yield return new KeyValuePair<string,object>("relatedArtifact",RelatedArtifact);
if (Library?.Any() == true) yield return new KeyValuePair<string,object>("library",Library);
if (KindElement is not null) yield return new KeyValuePair<string,object>("kind",KindElement);
if (Code is not null) yield return new KeyValuePair<string,object>("code",Code);
if (Timing is not null) yield return new KeyValuePair<string,object>(PocoDictionary.ComposeChoiceElementName("timing", Timing),Timing);
if (Location is not null) yield return new KeyValuePair<string,object>("location",Location);
if (Participant?.Any() == true) yield return new KeyValuePair<string,object>("participant",Participant);
if (Product is not null) yield return new KeyValuePair<string,object>(PocoDictionary.ComposeChoiceElementName("product", Product),Product);
if (Quantity is not null) yield return new KeyValuePair<string,object>("quantity",Quantity);
if (Dosage?.Any() == true) yield return new KeyValuePair<string,object>("dosage",Dosage);
if (BodySite?.Any() == true) yield return new KeyValuePair<string,object>("bodySite",BodySite);
if (Transform is not null) yield return new KeyValuePair<string,object>("transform",Transform);
if (DynamicValue?.Any() == true) yield return new KeyValuePair<string,object>("dynamicValue",DynamicValue);
}

}

}
Expand Down
Loading