Skip to content

Commit

Permalink
Expose KMongoSerializationRepository (Litote#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
BizarreAlex committed Feb 19, 2020
1 parent 881c68a commit 87e98a5
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var configuration: Configuration = Configuration()
/**
*
*/
internal object KMongoSerializationRepository {
object KMongoSerializationRepository {

private val serializersMap: Map<KClass<*>, KSerializer<*>> = mapOf(
ObjectId::class to ObjectIdSerializer,
Expand Down Expand Up @@ -139,7 +139,7 @@ internal object KMongoSerializationRepository {

@Suppress("UNCHECKED_CAST")
@ImplicitReflectionSerializer
fun <T : Any> getSerializer(kClass: KClass<T>, obj: T?): KSerializer<T> =
internal fun <T : Any> getSerializer(kClass: KClass<T>, obj: T?): KSerializer<T> =
if (obj == null) {
JsonNullSerializer as? KSerializer<T> ?: error("no serializer for null")
} else {
Expand All @@ -163,7 +163,7 @@ internal object KMongoSerializationRepository {

@Suppress("UNCHECKED_CAST")
@ImplicitReflectionSerializer
fun <T : Any> getSerializer(kClass: KClass<T>): KSerializer<T> =
internal fun <T : Any> getSerializer(kClass: KClass<T>): KSerializer<T> =
(serializersMap[kClass]
?: module.getContextual(kClass)
?: try {
Expand Down

0 comments on commit 87e98a5

Please sign in to comment.