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

kotlinx.serialization.csv.encode.ObjectCsvEncoder.kt Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package kotlinx.serialization.csv.encode

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.csv.Csv
import kotlinx.serialization.descriptors.SerialDescriptor

/**
 * CSV encoder for `object`s.
 *
 * Writes the name of the object (either fully-qualified class name or
 * [kotlinx.serialization.SerialName]).
 */
@OptIn(ExperimentalSerializationApi::class)
internal class ObjectCsvEncoder(
    csv: Csv,
    writer: CsvWriter,
    parent: CsvEncoder
) : SimpleCsvEncoder(csv, writer, parent) {

    override fun endStructure(descriptor: SerialDescriptor) {
        encodeString(descriptor.serialName)
        super.endStructure(descriptor)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy