Object's user extension now internal object's/implementation's state and can't be accessed outside 'ObjectOperations'

This commit is contained in:
Andrew Golovashevich 2025-05-28 20:28:59 +03:00
parent f228bd9769
commit 8fff112946
8 changed files with 28 additions and 32 deletions

View File

@ -1,15 +1,15 @@
package ru.landgrafhomyak.db.skeleton1.api package ru.landgrafhomyak.db.skeleton1.api
public interface ObjectOperations<@Suppress("unused") UE : Any?> { public interface ObjectOperations<@Suppress("unused") UE : Any?> {
public fun interface ImplementationsProvider<UE> { public fun interface ImplementationsProvider {
public fun provideStatementImplementations_databaseType(scope: Scope<UE>) public fun provideStatementImplementations_databaseType(scope: Scope)
public interface Scope<RUNTIME_TYPE> { public interface Scope {
@Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS") @Suppress("ERROR_SUPPRESSION", "BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER", "INCONSISTENT_TYPE_PARAMETER_BOUNDS")
public fun <OPERATIONS, OPERATIONS_UNBOUND> addImplementation( public fun <UE, OPERATIONS, OPERATIONS_UNBOUND> addImplementation(
key: DriverMetainfo<*, *, *, *, *, *, *, *, *, OPERATIONS_UNBOUND>, type: OPERATIONS key: DriverMetainfo<*, *, *, *, *, *, *, *, *, OPERATIONS_UNBOUND>, type: OPERATIONS
) where OPERATIONS_UNBOUND : ObjectOperations<*>, ) where OPERATIONS_UNBOUND : ObjectOperations<*>,
OPERATIONS : ObjectOperations<RUNTIME_TYPE>, OPERATIONS : ObjectOperations<UE>,
OPERATIONS : OPERATIONS_UNBOUND OPERATIONS : OPERATIONS_UNBOUND
} }
} }

View File

@ -36,7 +36,7 @@ public interface Module<mUE : Any> {
@ReflectionApi @ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")
@get:JvmName("getMemberObjects") @get:JvmName("getMemberObjects")
public val memberObjects: Collection<ModuleScopedObject<*, mUE>> public val memberObjects: Collection<ModuleScopedObject<mUE>>
@ReflectionApi @ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")

View File

@ -20,10 +20,10 @@ public interface ModuleConstructorScope<mUE : Any> {
name: String, initializer: Table.Constructor<tUE> name: String, initializer: Table.Constructor<tUE>
): Table<tUE, mUE> ): Table<tUE, mUE>
public fun <oUE : Any?> moduleScopedObject( public fun moduleScopedObject(
namespace: Namespace<mUE> = this.rootNs, namespace: Namespace<mUE> = this.rootNs,
name: String, metadata: ObjectOperations.ImplementationsProvider<oUE> name: String, metadata: ObjectOperations.ImplementationsProvider
): ModuleScopedObject<oUE, mUE> ): ModuleScopedObject<mUE>
public fun <smUE : Any> substituteModule(rootNs: Namespace<mUE>, template: Module.Template<smUE>): Module<smUE> public fun <smUE : Any> substituteModule(rootNs: Namespace<mUE>, template: Module.Template<smUE>): Module<smUE>

View File

@ -4,9 +4,7 @@ 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
public interface ModuleScopedObject<oUE : Any?, mUE : Any> { public interface ModuleScopedObject<mUE : Any> {
public val uExt: oUE
@ReflectionApi @ReflectionApi
public val name: String public val name: String
@ -19,5 +17,5 @@ public interface ModuleScopedObject<oUE : Any?, mUE : Any> {
public val pathFromModuleRoot: List<String> public val pathFromModuleRoot: List<String>
@ReflectionApi @ReflectionApi
public val meta: ObjectOperations.ImplementationsProvider<oUE> public val meta: ObjectOperations.ImplementationsProvider
} }

View File

@ -43,20 +43,20 @@ public interface ModuleUpgradeScope<nmUE : Any, omUE : Any> : ModuleConstructorS
// Object ------------------------------------------------------------------ // Object ------------------------------------------------------------------
public fun <oUE : Any?> keepModuleScopedObject(obj: ModuleScopedObject<oUE, omUE>): ModuleScopedObject<oUE, nmUE> public fun keepModuleScopedObject(obj: ModuleScopedObject< omUE>): ModuleScopedObject<nmUE>
public fun <oUE : Any?> renameModuleScopedObject( public fun renameModuleScopedObject(
obj: ModuleScopedObject<oUE, omUE>, obj: ModuleScopedObject<omUE>,
newNamespace: Namespace<nmUE>? = null, newName: String newNamespace: Namespace<nmUE>? = null, newName: String
): ModuleScopedObject<oUE, nmUE> ): ModuleScopedObject<nmUE>
public fun <oUE : Any?> deleteModuleScopedObject(obj: ModuleScopedObject<oUE, omUE>) public fun deleteModuleScopedObject(obj: ModuleScopedObject<omUE>)
public fun <oUE : Any?> deleteModuleScopedObjectAfterModuleUpgrade(obj: ModuleScopedObject<oUE, omUE>): ModuleScopedObject<oUE, nmUE> public fun deleteModuleScopedObjectAfterModuleUpgrade(obj: ModuleScopedObject<omUE>): ModuleScopedObject<nmUE>
public fun exportModuleScopedObject(obj: ModuleScopedObject<*, omUE>) public fun exportModuleScopedObject(obj: ModuleScopedObject<omUE>)
public fun <oUE : Any> importModuleScopedObject( public fun importModuleScopedObject(
obj: ModuleScopedObject<oUE, *>, obj: ModuleScopedObject<*>,
namespace: Namespace<nmUE> = this.rootNs, name: String namespace: Namespace<nmUE> = this.rootNs, name: String
): ModuleScopedObject<oUE, nmUE> ): ModuleScopedObject<nmUE>
// Module ------------------------------------------------------------------ // Module ------------------------------------------------------------------

View File

@ -32,7 +32,7 @@ public interface TableConstructorScope<tUE : Any> {
alterCreateColumn: RawStatement.Params2Void.ImplementationsProvider<sUE> alterCreateColumn: RawStatement.Params2Void.ImplementationsProvider<sUE>
): InputRow._Scope<sUE, Column<RT, tUE>> ): InputRow._Scope<sUE, Column<RT, tUE>>
public fun <oUE : Any?> tableScopedObject(name: String, metadata: ObjectOperations.ImplementationsProvider<oUE>): TableScopedObject<oUE, tUE> public fun tableScopedObject(name: String, metadata: ObjectOperations.ImplementationsProvider): TableScopedObject<tUE>
public fun addAlterStatement(stmt: _Statement.Void2Void<*>) public fun addAlterStatement(stmt: _Statement.Void2Void<*>)
public fun addAlterStatement(stmt: RawStatement.Void2Void.ImplementationsProvider<*>) public fun addAlterStatement(stmt: RawStatement.Void2Void.ImplementationsProvider<*>)

View File

@ -4,9 +4,7 @@ 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
public interface TableScopedObject<oUE : Any?, tUE : Any> { public interface TableScopedObject<tUE : Any> {
public val uExt: oUE
@ReflectionApi @ReflectionApi
public val name: String public val name: String
@ -14,7 +12,7 @@ public interface TableScopedObject<oUE : Any?, tUE : Any> {
public val table: Table<tUE, *> public val table: Table<tUE, *>
@ReflectionApi @ReflectionApi
public val meta: ObjectOperations.ImplementationsProvider<oUE> public val meta: ObjectOperations.ImplementationsProvider
@ReflectionApi @ReflectionApi
@Suppress("INAPPLICABLE_JVM_NAME") @Suppress("INAPPLICABLE_JVM_NAME")

View File

@ -11,10 +11,10 @@ public interface TableUpgradeScope<tnUE : Any, toUE : Any> : TableConstructorSco
public fun deleteColumn(c: Column<*, toUE>) public fun deleteColumn(c: Column<*, toUE>)
public fun <RT> deleteColumnAfterUpgrade(c: Column<RT, toUE>): Column<RT, tnUE> public fun <RT> deleteColumnAfterUpgrade(c: Column<RT, toUE>): Column<RT, tnUE>
public fun <oUE : Any?> keepTableScopedObject(obj: TableScopedObject<oUE, toUE>): TableScopedObject<oUE, tnUE> public fun keepTableScopedObject(obj: TableScopedObject<toUE>): TableScopedObject<tnUE>
public fun <oUE : Any?> renameTableScopedObject(obj: TableScopedObject<oUE, toUE>, newName: String): TableScopedObject<oUE, tnUE> public fun renameTableScopedObject(obj: TableScopedObject<toUE>, newName: String): TableScopedObject<tnUE>
public fun <oUE : Any?> deleteTableScopedObject(obj: TableScopedObject<oUE, toUE>) public fun deleteTableScopedObject(obj: TableScopedObject<toUE>)
public fun <oUE : Any?> deleteTableScopedObjectAfterUpgrade(obj: TableScopedObject<oUE, toUE>): TableScopedObject<oUE, tnUE> public fun deleteTableScopedObjectAfterUpgrade(obj: TableScopedObject<toUE>): TableScopedObject<tnUE>
public fun addAlterStatementAfterUpgrade(stmt: _Statement.Void2Void<*>) public fun addAlterStatementAfterUpgrade(stmt: _Statement.Void2Void<*>)
public fun addAlterStatementAfterUpgrade(stmt: RawStatement.Void2Void.ImplementationsProvider<*>) public fun addAlterStatementAfterUpgrade(stmt: RawStatement.Void2Void.ImplementationsProvider<*>)