KotlinTypeToken

open class KotlinTypeToken<T>(source)

Represents a generic type T.

You must make a subclass with the desired type, for example, for a List<String>:

var typeToken = new KotlinTypeToken<List<String>>() {};

However, you cannot create a KotlinTypeToken from a type variable (a generic, if you prefer):

<T> void myMethod() {
// Doesn't work!
var typeToken = new KotlinTypeToken<T>() {};
}

In other cases, you can create instances for any type using the static factory methods.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The Class instance representing the runtime class to which this type is erased to.

Link copied to clipboard

The Java type represented by this instance.

Link copied to clipboard

The KClass instance representing the runtime class to which this type is erased to.

Link copied to clipboard
val type: KType

The Kotlin type represented by this instance.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String