CurrentSession

interface CurrentSession

A container for all session instances.

Functions

Link copied to clipboard
abstract fun clear(name: String)

Clears a session instance for name.

Link copied to clipboard
abstract fun findName(type: KClass<*>): String

Finds a session name for the specified type or fails if it's not found.

Link copied to clipboard
abstract fun get(name: String): Any?

Gets a session instance for name

Link copied to clipboard
abstract fun set(name: String, value: Any?)

Sets a new session instance with name.

Extensions

Link copied to clipboard
inline fun <T : Any> CurrentSession.clear()

Clears a session instance with the type T.

Link copied to clipboard
inline fun <T : Any> CurrentSession.get(): T?
fun <T : Any> CurrentSession.get(klass: KClass<T>): T?

Gets a session instance with the type T.

Link copied to clipboard
inline fun <T : Any> CurrentSession.getOrSet(name: String = findName(T::class), generator: () -> T): T

Gets or generates a new session instance using generator with the type T (or name if specified)

Link copied to clipboard
inline fun <T : Any> CurrentSession.set(value: T?)

Sets a session instance with the type T.