de.lancom.openapi.jackson.KeySerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes
package de.lancom.openapi.jackson
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.ser.std.StdSerializer
abstract class KeySerializer(
clazz: Class,
) : StdSerializer(clazz) {
override fun serialize(value: K?, gen: JsonGenerator?, provider: SerializerProvider?) {
gen!!.writeFieldName(value?.key)
}
}