com.ancientlightstudios.quarkus.kotlin.openapi.models.kotlin.KotlinAnnotationContainer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-kotlin-openapi-maven-plugin Show documentation
Show all versions of quarkus-kotlin-openapi-maven-plugin Show documentation
A Maven plugin to use the OpenAPI generator.
package com.ancientlightstudios.quarkus.kotlin.openapi.models.kotlin
import com.ancientlightstudios.quarkus.kotlin.openapi.emitter.CodeWriter
class KotlinAnnotationContainer(private val onSingleLine: Boolean = false) : KotlinRenderable {
private val annotations = mutableListOf()
fun addAnnotation(annotation: KotlinAnnotation) {
annotations.add(annotation)
}
override fun ImportCollector.registerImports() {
registerFrom(annotations)
}
override fun render(writer: CodeWriter) = with(writer) {
annotations.forEach {
it.render(this)
if (onSingleLine) {
write(" ")
} else {
writeln()
}
}
}
}