TypeToken

data class TypeToken<T>(val type: KType)

A representation of the type T. Keeping this object generically typed enables us to ensure type-safety at the api level. Under the hood, the generic aspect of TypeToken is irrelevant, only the provided KType matters.

NOTE: In practice it's best to avoid using the primary constructor to create TypeTokens. Prefer the typeToken method which uses a reified type to ensure type data is captured completely.

Constructors

Link copied to clipboard
fun TypeToken(type: KType)

Properties

Link copied to clipboard
val type: KType