← back to roto on ba3a.dev

SourceStringSerializer

abstract class SourceStringSerializer<T : Any>(name: String, parse: (String) -> T, source: (T) -> String) : KSerializer<T>

A value written in JSON as its source string, parsed (and so validated) on the way in.

Inheritors

Constructors

Link copied to clipboard
constructor(name: String, parse: (String) -> T, source: (T) -> String)

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

A string, whatever the value.

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): T

Parses the source string, failing as the parser does for an invalid one.

Link copied to clipboard
open override fun serialize(encoder: Encoder, value: T)

Writes the value as its source string.