ClassSerialDescriptorBuilder

class ClassSerialDescriptorBuilder

Builder for SerialDescriptor for user-defined serializers.

Both explicit builder functions and implicit (using reified type-parameters) are present and are equivalent. For example, element<Int?>("nullableIntField") is indistinguishable from element("nullableIntField", IntSerializer.descriptor.nullable) and from element("nullableIntField", descriptor<Int?>).

Please refer to SerialDescriptor builder function for a complete example.

Functions

Link copied to clipboard
fun element(    elementName: String,     descriptor: SerialDescriptor,     annotations: List<Annotation> = emptyList(),     isOptional: Boolean = false)

Add an element with a given name, descriptor, type annotations and optionality the resulting descriptor.

Properties

Link copied to clipboard
var annotations: List<Annotation>

Serial annotations on a target type.

Link copied to clipboard
val serialName: String

Extensions

Link copied to clipboard
inline fun <T> ClassSerialDescriptorBuilder.element(    elementName: String,     annotations: List<Annotation> = emptyList(),     isOptional: Boolean = false)

A reified version of element function that extract descriptor using serializer<T>().descriptor call with all the restrictions of serializer<T>().descriptor.