spec.KotlinAnnotationClassSpec.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.spec
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import com.squareup.kotlinpoet.TypeSpec
import io.toolisticon.kotlin.generation.poet.KDoc
import kotlin.reflect.KClass
/**
* Represents an annotation class.
*/
@ExperimentalKotlinPoetApi
data class KotlinAnnotationClassSpec(
override val className: ClassName,
private val spec: TypeSpec
) : KotlinGeneratorTypeSpec, KotlinAnnotationClassSpecSupplier, KotlinDocumentableSpec {
override fun tag(type: KClass): T? = get().tag(type)
override fun spec(): KotlinAnnotationClassSpec = this
override fun get(): TypeSpec = spec
override val kdoc: KDoc get() = KDoc(spec.kdoc)
}
/**
* Marks the builder and the spec so they are interchangeable.
*/
@ExperimentalKotlinPoetApi
interface KotlinAnnotationClassSpecSupplier : KotlinGeneratorSpecSupplier, ToFileTypeSpecSupplier {
override fun get(): TypeSpec = spec().get()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy