Package com.episode6.mockspresso2.reflect

Types

Link copied to clipboard
data class DependencyKey<T>(val token: TypeToken<T>, val qualifier: Annotation? = null)

A representation of a binding "key" for Mockspresso's dependency Map. Every dependency in mockspresso is bound by a TypeToken and an optional qualifier Annotation.

Link copied to clipboard
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.

Functions

Link copied to clipboard
inline fun <T> dependencyKey(qualifier: Annotation? = null): DependencyKey<T>

Creates a DependencyKey of type T + qualifier

Link copied to clipboard
inline fun <T> typeToken(): TypeToken<T>

Creates a TypeToken which captures type T