spi.strategy.KotlinCodeGenerationStrategyBase.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-code-generation Show documentation
Show all versions of kotlin-code-generation Show documentation
Wrapping core components for kotlin code generation with kotlin-poet.
package io.toolisticon.kotlin.generation.spi.strategy
import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationContext
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationSpi
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationStrategy
import kotlin.reflect.KClass
/**
* Abstract base implementation of [KotlinCodeGenerationStrategy] for convenience setting of generic types.
*/
@ExperimentalKotlinPoetApi
abstract class KotlinCodeGenerationStrategyBase, INPUT : Any, SPEC : Any>(
override val contextType: KClass,
override val inputType: KClass,
override val specType: KClass,
override val order: Int = KotlinCodeGenerationSpi.DEFAULT_ORDER,
) : KotlinCodeGenerationStrategy {
abstract override fun invoke(context: CONTEXT, input: INPUT): SPEC
override fun test(context: CONTEXT, input: Any): Boolean = super.test(context, input)
override val name: String by lazy { javaClass.name }
override fun toString(): String = name
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy