diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/AccessWhileInitializationException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/AccessWhileInitializationException.kt index bde5565..e923fe9 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/AccessWhileInitializationException.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/AccessWhileInitializationException.kt @@ -14,7 +14,7 @@ public class AccessWhileInitializationException : IllegalStateException, Copyabl public val `object`: Any public val member: Any - public constructor(scope: Any, `object`: Any, member: Any) : super() { + public constructor(scope: Any, `object`: Any, member: Any) : super(formatMessage(scope, `object`, member)) { this.scope = scope this.`object` = `object` this.member = member @@ -32,7 +32,7 @@ public class AccessWhileInitializationException : IllegalStateException, Copyabl this.member = member } - public constructor(scope: Any, `object`: Any, member: Any, cause: Throwable) : super(cause) { + public constructor(scope: Any, `object`: Any, member: Any, cause: Throwable) : super(formatMessage(scope, `object`, member), cause) { this.scope = scope this.`object` = `object` this.member = member diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/EntityDeletedException.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/EntityDeletedException.kt new file mode 100644 index 0000000..dab8ec7 --- /dev/null +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/errors/EntityDeletedException.kt @@ -0,0 +1,55 @@ +package ru.landgrafhomyak.db.skeleton1.api.errors + +import kotlin.jvm.JvmStatic +import kotlinx.coroutines.CopyableThrowable +import kotlinx.coroutines.ExperimentalCoroutinesApi +import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi +import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam +import ru.landgrafhomyak.db.skeleton1.api.statement._Statement + +@ReflectionApi +@OptIn(ExperimentalCoroutinesApi::class) +public class EntityDeletedException : IllegalStateException, CopyableThrowable { + public val entity: Any + + public constructor(entity: Any) : super(formatMessage(entity)) { + this.entity = entity + } + + public constructor(entity: Any, customMessage: String) : super(customMessage) { + this.entity = entity + } + + public constructor(entity: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) { + this.entity = entity + } + + public constructor(entity: Any, cause: Throwable) : super(formatMessage(entity), cause) { + this.entity = entity + } + + public constructor( + entity: Any, + message: String?, + cause: Throwable?, + @Suppress("unused", "LocalVariableName") _marker: Unit + ) : super(message, cause) { + this.entity = entity + } + + + override fun createCopy(): EntityDeletedException? { + return EntityDeletedException( + entity = this.entity, + message = this.message, + cause = this.cause, + _marker = Unit + ) + } + + public companion object { + @JvmStatic + public fun formatMessage(entity: Any): String = + "Attempt to access deleted $entity" + } +} \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/Module.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/Module.kt index 60ac36e..08b2a13 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/Module.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/Module.kt @@ -43,26 +43,6 @@ public interface Module { @get:JvmName("getMemberSubmodules") public val memberSubmodules: Collection> - @ReflectionApi - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMemberTablesWhileUpgrade") - public val memberTablesWhileUpgrade: Collection> - - @ReflectionApi - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMemberObjectsWhileUpgrade") - public val memberObjectsWhileUpgrade: Collection> - - @ReflectionApi - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("getMemberSubmodulesWhileUpgrade") - public val memberSubmodulesWhileUpgrade: Collection> - - @ReflectionApi - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("willBeDeletedAfterUpgrade") - public val willBeDeletedAfterUpgrade: Boolean - public interface Constructor { @Suppress("INAPPLICABLE_JVM_NAME") @get:JvmName("versionKey") @@ -85,9 +65,9 @@ public interface Module { public interface Template<@Suppress("unused") mUE : Any> { @LowLevelApi - public fun getConstructor(): Constructor<*> + public fun getConstructor(): Constructor @LowLevelApi - public fun getUpgrade(version: String): Upgrade<*, *>? + public fun getUpgrade(version: String): Upgrade? } } \ No newline at end of file diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleConstructorScope.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleConstructorScope.kt index 8dc2d6a..f7096cd 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleConstructorScope.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleConstructorScope.kt @@ -25,7 +25,7 @@ public interface ModuleConstructorScope { name: String, metadata: ObjectOperations.ImplementationsProvider ): ModuleScopedObject - public fun substituteModule(rootNs: Namespace, template: Module.Template): Module + public fun substituteModule(rootNs: Namespace, template: Module.Template): Module public fun namespace(parent: Namespace, name: String): Namespace diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleScopedObject.kt b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleScopedObject.kt index 2bee8e4..90a6ab7 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleScopedObject.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/db/skeleton1/api/module/ModuleScopedObject.kt @@ -20,9 +20,4 @@ public interface ModuleScopedObject { @ReflectionApi public val meta: ObjectOperations.ImplementationsProvider - - @ReflectionApi - @Suppress("INAPPLICABLE_JVM_NAME") - @get:JvmName("willBeDeletedAfterUpgrade") - public val willBeDeletedAfterUpgrade: Boolean } \ No newline at end of file