ApiVersion now enum
This commit is contained in:
parent
fe289fe8c5
commit
3d0d2ec38e
@ -1,24 +1,11 @@
|
|||||||
package ru.landgrafhomyak.db.skeleton1.api
|
package ru.landgrafhomyak.db.skeleton1.api
|
||||||
|
|
||||||
import kotlin.jvm.JvmField
|
public enum class ApiVersion(public val str: String) {
|
||||||
|
V_0_0("0.0") {
|
||||||
public abstract class ApiVersion private constructor(public val str: String) {
|
override fun isImplements(v: ApiVersion) = this === v
|
||||||
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 toString(): String = "<db-skeleton api version '${this.str}'>"
|
||||||
|
|
||||||
override fun hashCode(): Int = this.str.hashCode()
|
public abstract fun isImplements(v: ApiVersion): Boolean
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -14,5 +14,6 @@ public interface DriverMetainfo<
|
|||||||
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_TABLE : RawStatement.Params2Table.Constructor<*>,
|
@Suppress("unused") STATEMENT_CONSTRUCTOR__PARAMS_2_TABLE : RawStatement.Params2Table.Constructor<*>,
|
||||||
@Suppress("unused") OBJECT_OPERATIONS : ObjectOperations<*>
|
@Suppress("unused") OBJECT_OPERATIONS : ObjectOperations<*>
|
||||||
> {
|
> {
|
||||||
public val apiVersion: ApiVersion
|
@ReflectionApi
|
||||||
|
public fun isImplements(version: ApiVersion): Boolean
|
||||||
}
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package ru.landgrafhomyak.db.skeleton1.api
|
||||||
|
|
||||||
|
@Retention(AnnotationRetention.BINARY)
|
||||||
|
public annotation class SinceApi(val version: ApiVersion)
|
Loading…
Reference in New Issue
Block a user