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

com.ancientlightstudios.quarkus.kotlin.openapi.models.kotlin.KotlinRenderableWrapContainer.kt Maven / Gradle / Ivy

There is a newer version: 0.4.14
Show newest version
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) }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy