ClusterPayload

class ClusterPayload


An object which encapsulates all the data read from the wire Once you get this object, the actual read is done streaming Organized around the in-memory type you want e.g. payload.uint.getNullable(tag, name)

Summary

Nested types

abstract inner class ClusterPayload.FieldReader<T : Any>

Reads fields in a type safe manner

Public constructors

ClusterPayload(payload: Map<UIntAny?>)

Public functions

ClusterPayload.FieldReader<T>
<T : Any> bitmap(adapter: BitmapAdapter<T>)

The returned FieldType will read custom bitmaps with a Bitmap class

ClusterPayload.FieldReader<T>
<T : ClusterEnum> enum(adapter: EnumAdapter<T>)

The returned FieldType will read enums backed by ULong

OptionalValue<T>
<T : Any?> OptionalValue<T?>.notNull(fieldName: String)

Converts an optional to a non-nullable optional or throws an exception

inline ClusterPayload.FieldReader<T>
<T : Any> struct(noinline defaultValueGenerator: () -> T)

Structs must be preparsed during readPayload() all this method does is cast the value that has already been read

inline ClusterPayload.FieldReader<T>
<T : Any> struct(
    adapter: StructAdapter<T>,
    noinline defaultValueGenerator: () -> T
)

Same as struct(), Structs must be preparsed during readPayload() This method is only here so that callers can use the Adapter for inference struct(FooAdapter) vs struct()

Public constructors

ClusterPayload

ClusterPayload(payload: Map<UIntAny?>)

Public functions

bitmap

fun <T : Any> bitmap(adapter: BitmapAdapter<T>): ClusterPayload.FieldReader<T>

The returned FieldType will read custom bitmaps with a Bitmap class

Parameters
adapter: BitmapAdapter<T>

used to convert the ULong to a BitMap

enum

fun <T : ClusterEnum> enum(adapter: EnumAdapter<T>): ClusterPayload.FieldReader<T>

The returned FieldType will read enums backed by ULong

Parameters
adapter: EnumAdapter<T>

used to convert the ULong to a runtime instance of an enum

notNull

fun <T : Any?> OptionalValue<T?>.notNull(fieldName: String): OptionalValue<T>

Converts an optional to a non-nullable optional or throws an exception

struct

inline fun <T : Any> struct(noinline defaultValueGenerator: () -> T): ClusterPayload.FieldReader<T>

Structs must be preparsed during readPayload() all this method does is cast the value that has already been read

struct

inline fun <T : Any> struct(
    adapter: StructAdapter<T>,
    noinline defaultValueGenerator: () -> T
): ClusterPayload.FieldReader<T>

Same as struct(), Structs must be preparsed during readPayload() This method is only here so that callers can use the Adapter for inference struct(FooAdapter) vs struct()