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

commonMain.kotlinx.serialization.internal.PluginHelperInterfaces.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.serialization.internal

import kotlinx.serialization.*
import kotlin.jvm.*
import kotlin.native.concurrent.*

@SharedImmutable
@JvmField
internal val EMPTY_SERIALIZER_ARRAY: Array> = arrayOf()

/**
 * An interface for a [KSerializer] instance generated by the compiler plugin.
 *
 * Should not be implemented manually or used directly.
 */
@InternalSerializationApi
public interface GeneratedSerializer : KSerializer {
    public fun childSerializers(): Array>
    public fun typeParametersSerializers(): Array> = EMPTY_SERIALIZER_ARRAY
}

/**
 * An internal interface used by the compiler plugin for objects that are factories of typed serializers, for example
 * for auto-generated companion objects for [Serializable] classes with type parameters.
 *
 * This interface is used to lookup and create serializers in K/N using `@AssociatedObjectKey`.
 * Should not be used in any user code. Please use generated `.serializer(kSerializer1, kSerializer2, ...)`
 * method on a companion or top-level `serializer(KType)` function.
 */
@InternalSerializationApi
@Deprecated("Inserted into generated code and should not be used directly", level = DeprecationLevel.HIDDEN)
public interface SerializerFactory {
    public fun serializer(vararg typeParamsSerializers: KSerializer<*>): KSerializer<*>
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy