ClusterPayload.FieldReader

abstract inner class ClusterPayload.FieldReader<T : Any>


Reads fields in a type safe manner

Parameters
<T : Any>

the runtime type

Summary

Public constructors

<T : Any> FieldReader()

Public functions

ClusterPayload.FieldReader<TO>
<TO : Any> adapt(adapter: FieldAdapter<T, TO>)

Convert this to another FieldType of a different type, usually used for Enums, Bitmaps etc but NOT structs which are handled by using the function struct()

abstract T
get(tag: UInt, name: String)

Get the field as an Required throws when the wire had a null or the field was not present on the wire

abstract List<T>
getList(tag: UInt, name: String)

Get the field as a Required List throws when the wire had no value or a null

abstract T?
getNullable(tag: UInt, name: String)

Get the field as an Required but Nullable throws when the wire had no value

abstract List<T>?
getNullableList(tag: UInt, name: String)

Get the field as a Required List but Nullable throws when the wire had no value

OptionalValue<T>
getOptional(tag: UInt, name: String)

Get the field as an Optional throws when the wire had a null

OptionalValue<List<T>>
getOptionalList(tag: UInt, name: String)

Get the field as an Optional List throws when the wire had a null

abstract OptionalValue<T?>

Get the field as an Optional Nullable

abstract OptionalValue<List<T>?>

Get the field as an Optional Nullable List

Public properties

abstract () -> T

Public constructors

FieldReader

<T : Any> FieldReader()
Parameters
<T : Any>

the runtime type

Public functions

adapt

fun <TO : Any> adapt(adapter: FieldAdapter<T, TO>): ClusterPayload.FieldReader<TO>

Convert this to another FieldType of a different type, usually used for Enums, Bitmaps etc but NOT structs which are handled by using the function struct()

Parameters
<TO : Any>

the runtime type this will be converted to

get

abstract fun get(tag: UInt, name: String = ""): T

Get the field as an Required throws when the wire had a null or the field was not present on the wire

getList

abstract fun getList(tag: UInt, name: String = ""): List<T>

Get the field as a Required List throws when the wire had no value or a null

getNullable

abstract fun getNullable(tag: UInt, name: String = ""): T?

Get the field as an Required but Nullable throws when the wire had no value

getNullableList

abstract fun getNullableList(tag: UInt, name: String = ""): List<T>?

Get the field as a Required List but Nullable throws when the wire had no value

getOptional

fun getOptional(tag: UInt, name: String = ""): OptionalValue<T>

Get the field as an Optional throws when the wire had a null

getOptionalList

fun getOptionalList(tag: UInt, name: String = ""): OptionalValue<List<T>>

Get the field as an Optional List throws when the wire had a null

getOptionalNullable

abstract fun getOptionalNullable(tag: UInt, name: String = ""): OptionalValue<T?>

Get the field as an Optional Nullable

getOptionalNullableList

abstract fun getOptionalNullableList(tag: UInt, name: String = ""): OptionalValue<List<T>?>

Get the field as an Optional Nullable List

Public properties

defaultValueGenerator

abstract val defaultValueGenerator: () -> T