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

spec.KotlinFunSpec.kt Maven / Gradle / Ivy

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

import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import com.squareup.kotlinpoet.FunSpec
import io.toolisticon.kotlin.generation.poet.FunSpecSupplier
import io.toolisticon.kotlin.generation.poet.KDoc
import kotlin.reflect.KClass

/**
 * Represents a function.
 */
@ExperimentalKotlinPoetApi
data class KotlinFunSpec(
  private val spec: FunSpec
) : KotlinGeneratorSpec, KotlinFunSpecSupplier, KotlinDocumentableSpec {

  override val kdoc: KDoc get() = KDoc(spec.kdoc)

  override fun  tag(type: KClass): T? = get().tag(type)
  override fun spec(): KotlinFunSpec = this
  override fun get(): FunSpec = spec
}

/**
 * Marks the builder and the spec so they are interchangeable.
 */
@ExperimentalKotlinPoetApi
interface KotlinFunSpecSupplier : KotlinGeneratorSpecSupplier, FunSpecSupplier {
  override fun get(): FunSpec = spec().get()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy