generators for models has been created

This commit is contained in:
2023-02-25 19:56:12 +06:00
parent 3718181e8f
commit d2e6d2ec80
12 changed files with 502 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package dev.inmo.micro_utils.repos.annotations
import kotlin.reflect.KClass
/**
* Use this annotation and ksp generator (module `micro_utils.repos.generator`) to create the next hierarchy of models:
*
* * New model. For example: data class NewTest
* * Registered model. For example: data class RegisteredTest
*
* @param registeredSupertypes These [KClass]es will be used as supertypes for registered model
* @param serializable If true (default) will generate @[kotlinx.serialization.Serializable] for models. Affects [generateSerialName]
* @param serializable If true (default) will generate @[kotlinx.serialization.SerialName] for models with their names as values
*
* @see GenerateCRUDModelExcludeOverride
*/
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)
annotation class GenerateCRUDModel(
vararg val registeredSupertypes: KClass<*>,
val serializable: Boolean = true,
val generateSerialName: Boolean = true
)
/**
* Use this annotation on properties which should be excluded from overriding in models.
*
* @see GenerateCRUDModel
*/
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.PROPERTY)
annotation class GenerateCRUDModelExcludeOverride