Skip to content

Commit 174715f

Browse files
committed
Regenerate sources
1 parent ed21402 commit 174715f

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

fhir-path-r4/src/commonMain/kotlin/dev/ohs/fhir/model/r4/ext/MoreComplexTypes.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import dev.ohs.fhir.model.r4.Dosage
4040
import dev.ohs.fhir.model.r4.Duration
4141
import dev.ohs.fhir.model.r4.Element
4242
import dev.ohs.fhir.model.r4.ElementDefinition
43+
import dev.ohs.fhir.model.r4.Enumeration
4344
import dev.ohs.fhir.model.r4.Expression
4445
import dev.ohs.fhir.model.r4.Extension
4546
import dev.ohs.fhir.model.r4.HumanName
@@ -82,6 +83,28 @@ import kotlin.Boolean as KotlinBoolean
8283
import kotlin.String as KotlinString
8384
import kotlin.collections.List
8485

86+
internal fun Enumeration<*>.getProperty(name: KotlinString): Any? =
87+
when (name) {
88+
"id" -> this.id
89+
"extension" -> this.extension
90+
"value" -> this.value
91+
else -> error("$name is not a valid property name")
92+
}
93+
94+
internal fun Enumeration<*>.hasProperty(name: KotlinString): KotlinBoolean =
95+
when (name) {
96+
"id" -> true
97+
"extension" -> true
98+
"value" -> true
99+
else -> false
100+
}
101+
102+
internal fun Enumeration<*>.getAllChildren(): List<Any> = buildList {
103+
this@getAllChildren.id?.let { add(it) }
104+
addAll(this@getAllChildren.extension)
105+
this@getAllChildren.value?.let { add(it) }
106+
}
107+
85108
internal fun Element.getProperty(name: KotlinString): Any? =
86109
when (this) {
87110
is Address -> getProperty(name)
@@ -144,6 +167,7 @@ internal fun Element.getProperty(name: KotlinString): Any? =
144167
is Url -> getProperty(name)
145168
is Uuid -> getProperty(name)
146169
is Xhtml -> getProperty(name)
170+
is Enumeration<*> -> getProperty(name)
147171
else -> null
148172
}
149173

@@ -209,6 +233,7 @@ internal fun Element.hasProperty(name: KotlinString): KotlinBoolean =
209233
is Url -> hasProperty(name)
210234
is Uuid -> hasProperty(name)
211235
is Xhtml -> hasProperty(name)
236+
is Enumeration<*> -> hasProperty(name)
212237
else -> false
213238
}
214239

@@ -274,5 +299,6 @@ internal fun Element.getAllChildren(): List<Any> =
274299
is Url -> getAllChildren()
275300
is Uuid -> getAllChildren()
276301
is Xhtml -> getAllChildren()
302+
is Enumeration<*> -> getAllChildren()
277303
else -> emptyList()
278304
}

fhir-path-r4b/src/commonMain/kotlin/dev/ohs/fhir/model/r4b/ext/MoreComplexTypes.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import dev.ohs.fhir.model.r4b.Dosage
4141
import dev.ohs.fhir.model.r4b.Duration
4242
import dev.ohs.fhir.model.r4b.Element
4343
import dev.ohs.fhir.model.r4b.ElementDefinition
44+
import dev.ohs.fhir.model.r4b.Enumeration
4445
import dev.ohs.fhir.model.r4b.Expression
4546
import dev.ohs.fhir.model.r4b.Extension
4647
import dev.ohs.fhir.model.r4b.HumanName
@@ -83,6 +84,28 @@ import kotlin.Boolean as KotlinBoolean
8384
import kotlin.String as KotlinString
8485
import kotlin.collections.List
8586

87+
internal fun Enumeration<*>.getProperty(name: KotlinString): Any? =
88+
when (name) {
89+
"id" -> this.id
90+
"extension" -> this.extension
91+
"value" -> this.value
92+
else -> error("$name is not a valid property name")
93+
}
94+
95+
internal fun Enumeration<*>.hasProperty(name: KotlinString): KotlinBoolean =
96+
when (name) {
97+
"id" -> true
98+
"extension" -> true
99+
"value" -> true
100+
else -> false
101+
}
102+
103+
internal fun Enumeration<*>.getAllChildren(): List<Any> = buildList {
104+
this@getAllChildren.id?.let { add(it) }
105+
addAll(this@getAllChildren.extension)
106+
this@getAllChildren.value?.let { add(it) }
107+
}
108+
86109
internal fun Element.getProperty(name: KotlinString): Any? =
87110
when (this) {
88111
is Address -> getProperty(name)
@@ -146,6 +169,7 @@ internal fun Element.getProperty(name: KotlinString): Any? =
146169
is Url -> getProperty(name)
147170
is Uuid -> getProperty(name)
148171
is Xhtml -> getProperty(name)
172+
is Enumeration<*> -> getProperty(name)
149173
else -> null
150174
}
151175

@@ -212,6 +236,7 @@ internal fun Element.hasProperty(name: KotlinString): KotlinBoolean =
212236
is Url -> hasProperty(name)
213237
is Uuid -> hasProperty(name)
214238
is Xhtml -> hasProperty(name)
239+
is Enumeration<*> -> hasProperty(name)
215240
else -> false
216241
}
217242

@@ -278,5 +303,6 @@ internal fun Element.getAllChildren(): List<Any> =
278303
is Url -> getAllChildren()
279304
is Uuid -> getAllChildren()
280305
is Xhtml -> getAllChildren()
306+
is Enumeration<*> -> getAllChildren()
281307
else -> emptyList()
282308
}

fhir-path-r5/src/commonMain/kotlin/dev/ohs/fhir/model/r5/ext/MoreComplexTypes.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import dev.ohs.fhir.model.r5.Dosage
4242
import dev.ohs.fhir.model.r5.Duration
4343
import dev.ohs.fhir.model.r5.Element
4444
import dev.ohs.fhir.model.r5.ElementDefinition
45+
import dev.ohs.fhir.model.r5.Enumeration
4546
import dev.ohs.fhir.model.r5.Expression
4647
import dev.ohs.fhir.model.r5.ExtendedContactDetail
4748
import dev.ohs.fhir.model.r5.Extension
@@ -86,6 +87,28 @@ import kotlin.Boolean as KotlinBoolean
8687
import kotlin.String as KotlinString
8788
import kotlin.collections.List
8889

90+
internal fun Enumeration<*>.getProperty(name: KotlinString): Any? =
91+
when (name) {
92+
"id" -> this.id
93+
"extension" -> this.extension
94+
"value" -> this.value
95+
else -> error("$name is not a valid property name")
96+
}
97+
98+
internal fun Enumeration<*>.hasProperty(name: KotlinString): KotlinBoolean =
99+
when (name) {
100+
"id" -> true
101+
"extension" -> true
102+
"value" -> true
103+
else -> false
104+
}
105+
106+
internal fun Enumeration<*>.getAllChildren(): List<Any> = buildList {
107+
this@getAllChildren.id?.let { add(it) }
108+
addAll(this@getAllChildren.extension)
109+
this@getAllChildren.value?.let { add(it) }
110+
}
111+
89112
internal fun Element.getProperty(name: KotlinString): Any? =
90113
when (this) {
91114
is Address -> getProperty(name)
@@ -152,6 +175,7 @@ internal fun Element.getProperty(name: KotlinString): Any? =
152175
is Url -> getProperty(name)
153176
is Uuid -> getProperty(name)
154177
is Xhtml -> getProperty(name)
178+
is Enumeration<*> -> getProperty(name)
155179
else -> null
156180
}
157181

@@ -221,6 +245,7 @@ internal fun Element.hasProperty(name: KotlinString): KotlinBoolean =
221245
is Url -> hasProperty(name)
222246
is Uuid -> hasProperty(name)
223247
is Xhtml -> hasProperty(name)
248+
is Enumeration<*> -> hasProperty(name)
224249
else -> false
225250
}
226251

@@ -290,5 +315,6 @@ internal fun Element.getAllChildren(): List<Any> =
290315
is Url -> getAllChildren()
291316
is Uuid -> getAllChildren()
292317
is Xhtml -> getAllChildren()
318+
is Enumeration<*> -> getAllChildren()
293319
else -> emptyList()
294320
}

0 commit comments

Comments
 (0)