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

com.ancientlightstudios.quarkus.kotlin.openapi.models.kotlin.KotlinAnnotationContainer.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

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()
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy