Additional reflection properties

This commit is contained in:
Andrew Golovashevich 2025-05-18 16:29:48 +03:00
parent bb4fadac9d
commit 64fd1d9958
8 changed files with 139 additions and 8 deletions

View File

@ -1,41 +1,50 @@
package ru.landgrafhomyak.db.skeleton1.api.errors package ru.landgrafhomyak.db.skeleton1.api.errors
import kotlin.jvm.JvmStatic
import kotlinx.coroutines.CopyableThrowable import kotlinx.coroutines.CopyableThrowable
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
import ru.landgrafhomyak.db.skeleton1.api.statement.InputParam
import ru.landgrafhomyak.db.skeleton1.api.statement._Statement
@ReflectionApi @ReflectionApi
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> { public class AccessWhileInitializationException : IllegalStateException, CopyableThrowable<AccessWhileInitializationException> {
public val scope: Any
public val `object`: Any public val `object`: Any
public val member: Any public val member: Any
public constructor(`object`: Any, member: Any) : super() { public constructor(scope: Any, `object`: Any, member: Any) : super() {
this.scope = scope
this.`object` = `object` this.`object` = `object`
this.member = member this.member = member
} }
public constructor(`object`: Any, member: Any, message: String) : super(message) { public constructor(scope: Any, `object`: Any, member: Any, customMessage: String) : super(customMessage) {
this.scope = scope
this.`object` = `object` this.`object` = `object`
this.member = member this.member = member
} }
public constructor(`object`: Any, member: Any, message: String, cause: Throwable) : super(message, cause) { public constructor(scope: Any, `object`: Any, member: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.scope = scope
this.`object` = `object` this.`object` = `object`
this.member = member this.member = member
} }
public constructor(`object`: Any, member: Any, cause: Throwable) : super(cause) { public constructor(scope: Any, `object`: Any, member: Any, cause: Throwable) : super(cause) {
this.scope = scope
this.`object` = `object` this.`object` = `object`
this.member = member this.member = member
} }
public constructor( public constructor(
`object`: Any, member: Any, scope: Any, `object`: Any, member: Any,
message: String?, message: String?,
cause: Throwable?, cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit @Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause) { ) : super(message, cause) {
this.scope = scope
this.`object` = `object` this.`object` = `object`
this.member = member this.member = member
} }
@ -43,6 +52,7 @@ public class AccessWhileInitializationException : IllegalStateException, Copyabl
override fun createCopy(): AccessWhileInitializationException? { override fun createCopy(): AccessWhileInitializationException? {
return AccessWhileInitializationException( return AccessWhileInitializationException(
scope = this.scope,
`object` = this.`object`, `object` = this.`object`,
member = this.member, member = this.member,
message = this.message, message = this.message,
@ -50,4 +60,10 @@ public class AccessWhileInitializationException : IllegalStateException, Copyabl
_marker = Unit _marker = Unit
) )
} }
public companion object {
@JvmStatic
public fun formatMessage(scope: Any, `object`: Any, member: Any): String =
"Attempt to access $member of $`object` before it's producer scope $scope not finished"
}
} }

View File

@ -0,0 +1,62 @@
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 ScopeAlreadyFinishedException : IllegalStateException, CopyableThrowable<ScopeAlreadyFinishedException> {
public val scope: Any
public val member: Any
public constructor(scope: Any, member: Any) : super() {
this.scope = scope
this.member = member
}
public constructor(scope: Any, member: Any, customMessage: String) : super(customMessage) {
this.scope = scope
this.member = member
}
public constructor(scope: Any, member: Any, customMessage: String, cause: Throwable) : super(customMessage, cause) {
this.scope = scope
this.member = member
}
public constructor(scope: Any, member: Any, cause: Throwable) : super(cause) {
this.scope = scope
this.member = member
}
public constructor(
scope: Any, member: Any,
message: String?,
cause: Throwable?,
@Suppress("unused", "LocalVariableName") _marker: Unit
) : super(message, cause) {
this.scope = scope
this.member = member
}
override fun createCopy(): ScopeAlreadyFinishedException? {
return ScopeAlreadyFinishedException(
scope = this.scope,
member = this.member,
message = this.message,
cause = this.cause,
_marker = Unit
)
}
public companion object {
@JvmStatic
public fun formatMessage(scope: Any, member: Any): String =
"Attempt to access $member of $scope after it was closed"
}
}

View File

@ -35,8 +35,28 @@ public interface Module<mUE : Any, IK : Any> {
@ReflectionApi @ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberModules") @get:JvmName("getMemberSubmodules")
public val memberModules: Collection<Module<*, IK>> public val memberSubmodules: Collection<Module<*, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberTablesWhileUpgrade")
public val memberTablesWhileUpgrade: Collection<Table<*, mUE, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberObjectsWhileUpgrade")
public val memberObjectsWhileUpgrade: Collection<ModuleScopedObject<*, mUE, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberSubmodulesWhileUpgrade")
public val memberSubmodulesWhileUpgrade: Collection<Module<*, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("willBeDeletedAfterUpgrade")
public val willBeDeletedAfterUpgrade: Boolean
public interface Constructor<mUE : Any, IK : Any> { public interface Constructor<mUE : Any, IK : Any> {
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")

View File

@ -1,5 +1,6 @@
package ru.landgrafhomyak.db.skeleton1.api.module package ru.landgrafhomyak.db.skeleton1.api.module
import kotlin.jvm.JvmName
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
import ru.landgrafhomyak.db.skeleton1.api.ObjectOperations import ru.landgrafhomyak.db.skeleton1.api.ObjectOperations
@ -17,4 +18,9 @@ public interface ModuleScopedObject<oUE : Any?, mUE : Any, IK : Any> {
@ReflectionApi @ReflectionApi
public val meta: ObjectOperations.ImplementationsProvider<oUE> public val meta: ObjectOperations.ImplementationsProvider<oUE>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("willBeDeletedAfterUpgrade")
public val willBeDeletedAfterUpgrade: Boolean
} }

View File

@ -18,4 +18,9 @@ public interface Column<RT, tUE : Any, IK : Any> {
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getTable") @get:JvmName("getTable")
public val table: Table<tUE, *, IK> public val table: Table<tUE, *, IK>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("willBeDeletedAfterUpgrade")
public val willBeDeletedAfterUpgrade: Boolean
} }

View File

@ -47,6 +47,21 @@ public interface Table<UE : Any, mUE : Any, IK : Any> {
@get:JvmName("getMemberObjects") @get:JvmName("getMemberObjects")
public val memberObjects: Collection<TableScopedObject<*, UE, IK>> public val memberObjects: Collection<TableScopedObject<*, UE, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberColumnsWhileUpgrade")
public val memberColumnsWhileUpgrade: Collection<Column<*, UE, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberObjectsWhileUpgrade")
public val memberObjectsWhileUpgrade: Collection<TableScopedObject<*, UE, IK>>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("willBeDeletedAfterUpgrade")
public val willBeDeletedAfterUpgrade: Boolean
public interface Constructor<tUE : Any, RK : Any> { public interface Constructor<tUE : Any, RK : Any> {
public fun createTable(context: TableConstructorScope<tUE, RK>): tUE public fun createTable(context: TableConstructorScope<tUE, RK>): tUE
} }

View File

@ -1,5 +1,6 @@
package ru.landgrafhomyak.db.skeleton1.api.table package ru.landgrafhomyak.db.skeleton1.api.table
import kotlin.jvm.JvmName
import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi import ru.landgrafhomyak.db.skeleton1.api.ReflectionApi
import ru.landgrafhomyak.db.skeleton1.api.ObjectOperations import ru.landgrafhomyak.db.skeleton1.api.ObjectOperations
@ -14,4 +15,9 @@ public interface TableScopedObject<oUE : Any?, tUE : Any, IK : Any> {
@ReflectionApi @ReflectionApi
public val meta: ObjectOperations.ImplementationsProvider<oUE> public val meta: ObjectOperations.ImplementationsProvider<oUE>
@ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("willBeDeletedAfterUpgrade")
public val willBeDeletedAfterUpgrade: Boolean
} }

View File

@ -13,7 +13,8 @@ public interface TableUpgradeScope<tnUE : Any, toUE : Any, IK : Any> : TableCons
public fun <oUE : Any?> keepTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>): TableScopedObject<oUE, tnUE, IK> public fun <oUE : Any?> keepTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>): TableScopedObject<oUE, tnUE, IK>
public fun <oUE : Any?> renameTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>, newName: String): TableScopedObject<oUE, tnUE, IK> public fun <oUE : Any?> renameTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>, newName: String): TableScopedObject<oUE, tnUE, IK>
public fun <oUE : Any?> deleteTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>): TableScopedObject<oUE, tnUE, IK> public fun <oUE : Any?> deleteTableScopedObject(obj: TableScopedObject<oUE, toUE, IK>)
public fun <oUE : Any?> deleteTableScopedObjectAfterUpgrade(obj: TableScopedObject<oUE, toUE, IK>): TableScopedObject<oUE, tnUE, IK>
public fun addAlterStatementAfterUpgrade(stmt: _Statement.Void2Void<*, IK>) public fun addAlterStatementAfterUpgrade(stmt: _Statement.Void2Void<*, IK>)
public fun addAlterStatementAfterUpgrade(stmt: RawStatement.Void2Void.ImplementationsProvider<*>) public fun addAlterStatementAfterUpgrade(stmt: RawStatement.Void2Void.ImplementationsProvider<*>)