Serde

@NullMarked
interface Serde<T> : TypeTag<T>

Interface defining serialization and deserialization of concrete types.

For more info on the serialization stack, and how to customize it, see SerdeFactory.

Implementations MUST be thread safe.

You can create a custom one using using.

See also

Types

Link copied to clipboard
Schema to be serialized using internal Jackson mapper.
Link copied to clipboard
interface Schema
Link copied to clipboard
Schema already serialized to String.

Properties

Link copied to clipboard
Pass through Serde for byte array.
Link copied to clipboard
Passthrough serializer/deserializer
Link copied to clipboard
val VOID: Serde<@Nullable Void>
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: Slice): T
Link copied to clipboard
@Nullable
open fun jsonSchema(): @Nullable Serde.Schema
Link copied to clipboard
open fun <T> of(serde: Serde<T>): TypeTag<T>
open fun <T> of(type: TypeRef<T>): TypeTag<T>

open fun <T> of(type: Class<T>): TypeTag<T>
Create a TypeTag from a java.lang.Class.
Link copied to clipboard
abstract fun serialize(value: T): Slice
Link copied to clipboard
open fun <T> using(serializer: ThrowingFunction<T, Array<Byte>>, deserializer: ThrowingFunction<Array<Byte>, T>): Serde<@NonNull 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<@NonNull 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>