io.javalin.plugin.openapi.dsl.OpenApiUpdater.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javalin Show documentation
Show all versions of javalin Show documentation
Javalin: Simple REST APIs for Java and Kotlin
package io.javalin.plugin.openapi.dsl
@FunctionalInterface
interface OpenApiUpdater {
fun applyUpdates(value: T)
}
typealias ApplyUpdates = (value: T) -> Unit
fun createUpdaterIfNotNull(function: ApplyUpdates?) = function?.let { createUpdater(it) }
fun createUpdater(function: ApplyUpdates) = object : OpenApiUpdater {
override fun applyUpdates(value: T) = function(value)
}
fun List>.applyAllUpdates(value: T) = this.forEach { it.applyUpdates(value) }