CurrentSession

interface CurrentSession

Represents a container for all session instances

Functions

clear

abstract fun clear(name: String): Unit

Clear session instance for name

findName

abstract fun findName(type: KClass<*>): String

Find session name for the specified type or fail if not found

get

abstract fun get(name: String): Any?

Get session instance for name

set

abstract fun set(name: String, value: Any?): Unit

Set new session instance with name

Extension Functions

clear

fun <T> CurrentSession.clear(): Unit

Clear session instance with type T

get

fun <T> CurrentSession.get(): T?

Get session instance with type T

getOrSet

fun <T> CurrentSession.getOrSet(
    name: String = findName(T::class),
    generator: () -> T
): T

Get or generate a new session instance using generator with type T (or name if specified)

set

fun <T> CurrentSession.set(value: T?): Unit

Set session instance with type T