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

entities.EntityIdBSONCodec.kt Maven / Gradle / Ivy

There is a newer version: 0.9.27
Show newest version
package com.github.fluidsonic.baku

import org.bson.BsonReader
import org.bson.BsonWriter


internal class EntityIdBSONCodec(
	private val factory: EntityId.Factory
) : AbstractBSONCodec(valueClass = factory.idClass.java) {

	override fun BsonReader.decode(context: BSONCodingContext) =
		factory.run { readIdValue() }


	override fun BsonWriter.encode(value: Id, context: BSONCodingContext) {
		factory.run { writeIdValue(value) }
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy