com.ancientlightstudios.quarkus.kotlin.openapi.models.kotlin.KotlinRenderableWrapContainer.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
import com.ancientlightstudios.quarkus.kotlin.openapi.utils.renderWithWrap
class KotlinRenderableWrapContainer(val maxSizeForSingleLine : Int = 1) : KotlinRenderable {
private val items = mutableListOf()
fun addItem(item: T) {
items.add(item)
}
val isNotEmpty: Boolean
get() = items.isNotEmpty()
override fun ImportCollector.registerImports() {
registerFrom(items)
}
override fun render(writer: CodeWriter) = with(writer) {
renderWithWrap(items, maxSizeForSingleLine = maxSizeForSingleLine) { it.render(this) }
}
}