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

spi.strategy._abstract.kt Maven / Gradle / Ivy

There is a newer version: 0.1.0
Show newest version
package io.toolisticon.kotlin.generation.spi.strategy

import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import io.toolisticon.kotlin.generation.spec.KotlinFileSpecIterable
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationContext
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationSpi
import kotlin.reflect.KClass

/**
 * Base class for [KotlinFileSpecStrategy] and [KotlinFileSpecListStrategy] so we can join single and multi results
 * during generation.
 */
@ExperimentalKotlinPoetApi
sealed class KotlinFileSpecIterableStrategy, INPUT : Any, SPEC : KotlinFileSpecIterable>(
  contextType: KClass,
  override val inputType: KClass,
  specType: KClass,
  order: Int = KotlinCodeGenerationSpi.DEFAULT_ORDER,
) : KotlinCodeGenerationStrategyBase(
  contextType = contextType,
  inputType = inputType,
  specType = specType,
  order = order
) {

  abstract override fun invoke(context: CONTEXT, input: INPUT): SPEC

  override fun test(context: CONTEXT, input: Any): Boolean = super.test(context, input)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy