bson.BSONCodec.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of baku Show documentation
Show all versions of baku Show documentation
helps you focus your REST API back-end on the business logic
package com.github.fluidsonic.baku
import org.bson.BsonReader
import org.bson.BsonWriter
import org.bson.codecs.Codec
import org.bson.codecs.DecoderContext
import org.bson.codecs.EncoderContext
import kotlin.reflect.KClass
interface BSONCodec : BSONCodecProvider, Codec {
override fun decode(reader: BsonReader, decoderContext: DecoderContext): Value
override fun encode(writer: BsonWriter, value: Value, encoderContext: EncoderContext)
@Suppress("UNCHECKED_CAST")
override fun codecForClass(valueClass: KClass) =
if (encoderClass == valueClass.java)
this as BSONCodec
else
null
}