A light multiplatform Kotlin reflection API.
erased
generates aTypeToken
that represents a type without its (optional) generic parameters, constructed at compile-time (no run-time reflection overhead).generic
generates aTypeToken
that represents a type with its generic parameters, constructed at compile-time (with reflection).erasedComp
generates aTypeToken
that represents a type with its generic parameters, constructed at run-time (with explicit parameters: no run-time overhead but verbose syntax).
All TypeTokens are comparable between them:
erased<String>() == generic<String>()
erased<List<*>>() == generic<List<*>>()
generic<List<String>>() == erasedComp<List<String>>(List::class, String::class)