Serde

interface Serde<T>

Interface defining serialization and deserialization of concrete types.

Serde implementations are provided in JsonSerdes in sdk-api, KtSerdes in sdk-api-kotlin, JacksonSerdes in sdk-serde-jackson, ProtobufSerdes in sdk-serde-protobuf.

You can create a custom one using using.

Properties

Link copied to clipboard
Link copied to clipboard
Pass through Serde for byte array.
Link copied to clipboard
Noop Serde for void.

Functions

Link copied to clipboard
@Nullable
open fun contentType(): @Nullable String
Content-type to use in request/responses.
Link copied to clipboard
abstract fun deserialize(value: Array<Byte>): T
open fun deserialize(byteBuffer: ByteBuffer): T
Link copied to clipboard
abstract fun serialize(@Nullable value: @Nullable T): Array<Byte>
Link copied to clipboard
open fun serializeToByteBuffer(@Nullable value: @Nullable T): ByteBuffer
Link copied to clipboard
open fun <T> using(serializer: ThrowingFunction<T, Array<Byte>>, deserializer: ThrowingFunction<Array<Byte>, T>): Serde<T>
Like using, using content-type application/octet-stream.
open fun <T> using(contentType: String, serializer: ThrowingFunction<T, Array<Byte>>, deserializer: ThrowingFunction<Array<Byte>, T>): Serde<T>
Create a Serde from serializer/deserializer lambdas, tagging with contentType.
Link copied to clipboard
open fun <T> withContentType(contentType: String, inner: Serde<T>): Serde<T>