commonMain.kotlinx.serialization.modules.SerializersModuleCollector.kt Maven / Gradle / Ivy
/*
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
@file:Suppress("RedundantVisibilityModifier")
package kotlinx.serialization.modules
import kotlinx.serialization.*
import kotlin.reflect.*
/**
* [SerializersModuleCollector] can introspect and accumulate content of any [SerializersModule] via [SerializersModule.dumpTo],
* using a visitor-like pattern: [contextual] and [polymorphic] functions are invoked for each registered serializer.
*/
public interface SerializersModuleCollector {
/**
* Accept a serializer, associated with [kClass] for contextual serialization.
*/
public fun contextual(kClass: KClass, serializer: KSerializer)
/**
* Accept a serializer, associated with [actualClass] for polymorphic serialization.
*/
public fun polymorphic(
baseClass: KClass ,
actualClass: KClass,
actualSerializer: KSerializer
)
/**
* Accept a default serializer provider, associated with the [baseClass] for polymorphic serialization.
*/
public fun polymorphicDefault(
baseClass: KClass ,
defaultSerializerProvider: (className: String) -> DeserializationStrategy?
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy