Skip to content

Commit b0c5589

Browse files
committed
replace GeneratedConcept._typed with .typed()
1 parent 2e56b6a commit b0c5589

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

editor-runtime/src/commonMain/kotlin/org/modelix/editor/CellTemplateBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import org.modelix.model.api.*
55
import kotlin.jvm.JvmName
66

77
open class CellTemplateBuilder<NodeT : ITypedNode, ConceptT : ITypedConcept>(val template: CellTemplate<NodeT, ConceptT>) {
8-
val concept: ConceptT = template.concept._typed
8+
val concept: ConceptT = template.concept.typed()
99
val properties = CellProperties()
1010

1111
fun ifEmpty(link: IChildLink, body: ()->Unit) {

metamodel-generator/src/main/kotlin/org/modelix/metamodel/generator/MetaModelGenerator.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ class MetaModelGenerator(val outputDir: Path) {
149149
addProperty(PropertySpec.builder(GeneratedConcept<*, *>::instanceClass.name, instanceClassType, KModifier.OVERRIDE)
150150
.initializer(concept.nodeWrapperImplName() + "::class")
151151
.build())
152-
addProperty(PropertySpec.builder(GeneratedConcept<*, *>::_typed.name, concept.conceptWrapperImplType(), KModifier.OVERRIDE)
153-
.getter(FunSpec.getterBuilder().addStatement("""return %T""", concept.conceptWrapperInterfaceType()).build())
152+
addFunction(FunSpec.builder(GeneratedConcept<*, *>::typed.name)
153+
.addModifiers(KModifier.OVERRIDE)
154+
.addStatement("""return %T""", concept.conceptWrapperInterfaceType())
154155
.build())
155156
addProperty(PropertySpec.builder(IConcept::language.name, ILanguage::class, KModifier.OVERRIDE)
156157
.initializer(concept.language.generatedClassName().simpleName)

metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/GeneratedConcept.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ abstract class GeneratedConcept<InstanceT : ITypedNode, WrapperT : ITypedConcept
77
private val name: String,
88
private val is_abstract: Boolean
99
) : IConcept {
10-
abstract val _typed: WrapperT
10+
@Deprecated("use .typed()", ReplaceWith("typed()"))
11+
val _typed: WrapperT get() = typed()
12+
abstract fun typed(): WrapperT
1113
abstract val instanceClass: KClass<InstanceT>
1214
private val propertiesMap: MutableMap<String, GeneratedProperty<*>> = LinkedHashMap()
1315
private val childLinksMap: MutableMap<String, GeneratedChildLink<*, *>> = LinkedHashMap()

metamodel-runtime/src/commonMain/kotlin/org/modelix/metamodel/ITypedConcept.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class FallbackTypedConcept(private val untypedConcept: IConcept) : ITypedConcept
1515
}
1616

1717
fun IConcept.typed(): ITypedConcept = when (this) {
18-
is GeneratedConcept<*, *> -> this._typed
18+
is GeneratedConcept<*, *> -> this.typed()
1919
else -> FallbackTypedConcept(this)
2020
}
2121

0 commit comments

Comments
 (0)