Reflection to check supported by driver api versions

This commit is contained in:
Andrew Golovashevich 2025-05-12 10:27:21 +03:00
parent ba11a41dc9
commit 6f5a21e621
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package ru.landgrafhomyak.db.skeleton1.api
import kotlin.jvm.JvmField
public abstract class ApiVersion private constructor(public val str: String) {
override fun equals(other: Any?): Boolean {
if (other == null) return false
if (other !is ApiVersion) return false
return this === other
}
override fun toString(): String = "<db-skeleton api version '${this.str}'>"
override fun hashCode(): Int = this.str.hashCode()
public abstract fun isImplements(lower: ApiVersion): Boolean
public companion object {
@JvmField
public val V_0_0: ApiVersion = object : ApiVersion("0.0") {
override fun isImplements(lower: ApiVersion) = this === lower
}
}
}

View File

@ -14,4 +14,5 @@ public interface DriverMetainfo<
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_TABLE : RawStatement.Params2Table.Constructor<*>,
@Suppress("unused") OBJECT_OPERATIONS : ObjectOperations<*>
> {
public val apiVersion: ApiVersion
}