All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spi.processor.KotlinCodeGenerationProcessorBase.kt Maven / Gradle / Ivy

There is a newer version: 0.1.0
Show newest version
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