File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ object OptionalIntPropertySerializer : IPropertyValueSerializer<Int?> {
8080
8181class MandatoryEnumSerializer <E : Enum <* >>(
8282 private val memberIdOf : (E ) -> String ,
83- private val fromString : (String? ) -> E
83+ private val fromMemberId : (String? ) -> E
8484) : IPropertyValueSerializer<E> {
8585
8686 override fun serialize (value : E ): String {
@@ -89,21 +89,22 @@ class MandatoryEnumSerializer<E : Enum<*>>(
8989
9090 override fun deserialize (serialized : String? ): E {
9191 val id = serialized?.substringBefore(' /' )
92- return fromString (id)
92+ return fromMemberId (id)
9393 }
9494}
9595
9696class OptionalEnumSerializer <E : Enum <* >>(
9797 private val memberIdOf : (E ) -> String ,
98- private val fromString : (String ) -> E
98+ private val fromMemberId : (String ) -> E
9999) : IPropertyValueSerializer<E?> {
100100
101101 override fun serialize (value : E ? ): String? {
102102 return value?.let { memberIdOf(it) + " /" + it.name}
103103 }
104104
105105 override fun deserialize (serialized : String? ): E ? {
106- return serialized?.let { fromString(it) }
106+ val id = serialized?.substringBefore(' /' )
107+ return id?.let { fromMemberId(it) }
107108 }
108109}
109110
You can’t perform that action at this time.
0 commit comments