spi.processor.KotlinCodeGenerationProcessorBase.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.processor
import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationContext
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationProcessor
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationSpi
import kotlin.reflect.KClass
/**
* Abstract base implementation of [KotlinCodeGenerationProcessor] for convenience setting of generic types.
*/
@ExperimentalKotlinPoetApi
abstract class KotlinCodeGenerationProcessorBase, INPUT : Any, BUILDER : Any>(
override val contextType: KClass,
override val inputType: KClass,
override val builderType: KClass,
override val order: Int = KotlinCodeGenerationSpi.DEFAULT_ORDER,
) : KotlinCodeGenerationProcessor {
abstract override fun invoke(context: CONTEXT, input: INPUT, builder: BUILDER): BUILDER
override fun test(context: CONTEXT, input: Any): Boolean = super.test(context, input)
override val name: String by lazy { this.javaClass.name }
override fun toString(): String = name
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy