From da94b8b62167db583ab89cb94284af09388226b6 Mon Sep 17 00:00:00 2001 From: Sven Braune Date: Tue, 28 Feb 2023 11:02:28 +0100 Subject: [PATCH] # based models are now resolved with multiple basedon layer chains --- .../crystalprocessor/model/EntityFactory.kt | 1 + .../crystaldemo/entity/AndAnotherBaseModel.kt | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 demo/src/main/java/com/schwarz/crystaldemo/entity/AndAnotherBaseModel.kt diff --git a/crystal-map-processor/src/main/java/com/schwarz/crystalprocessor/model/EntityFactory.kt b/crystal-map-processor/src/main/java/com/schwarz/crystalprocessor/model/EntityFactory.kt index a2391c61..727f0c29 100644 --- a/crystal-map-processor/src/main/java/com/schwarz/crystalprocessor/model/EntityFactory.kt +++ b/crystal-map-processor/src/main/java/com/schwarz/crystalprocessor/model/EntityFactory.kt @@ -152,6 +152,7 @@ object EntityFactory { } content.generateAccessors.addAll(it.generateAccessors) content.queries.addAll(it.queries) + addBasedOn(it.sourceElement, allBaseModels, content) } } } diff --git a/demo/src/main/java/com/schwarz/crystaldemo/entity/AndAnotherBaseModel.kt b/demo/src/main/java/com/schwarz/crystaldemo/entity/AndAnotherBaseModel.kt new file mode 100644 index 00000000..1444480b --- /dev/null +++ b/demo/src/main/java/com/schwarz/crystaldemo/entity/AndAnotherBaseModel.kt @@ -0,0 +1,14 @@ +package com.schwarz.crystaldemo.entity + +import com.schwarz.crystalapi.* +import com.schwarz.crystaldemo.customtypes.GenerateClassName + +@com.schwarz.crystalapi.BaseModel +@MapWrapper +@Entity +@Fields( + Field(name = "andAnotherBaseThing", type = String::class), + Field(name = "clazzName", type = GenerateClassName::class, defaultValue = "GenerateClassName(this::class.simpleName ?: \"\")") +) +@BasedOn(AnotherBaseModel::class) +open class AndAnotherBaseModel