![JAR search and dependency download from the Maven repository](/logo.png)
com.ancientlightstudios.quarkus.kotlin.openapi.utils.CodeWriterExtension.kt Maven / Gradle / Ivy
package com.ancientlightstudios.quarkus.kotlin.openapi.utils
import com.ancientlightstudios.quarkus.kotlin.openapi.emitter.CodeWriter
fun CodeWriter.renderWithWrap(
parameters: List,
maxSizeForSingleLine: Int = 1,
delimiter: String = ", ",
block: CodeWriter.(T) -> Unit
) {
// block to render the parameters. but will be called later
val parameterBlock: CodeWriter.(Boolean) -> Unit = { newLine ->
parameters.forEachWithStats { status, it ->
block(it)
if (!status.last) {
write(delimiter, newLineAfter = newLine)
}
}
}
if (parameters.size > maxSizeForSingleLine) {
indent(newLineBefore = true, newLineAfter = true) { parameterBlock(true) }
} else {
parameterBlock(false)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy