get

inline operator fun <T> get(key: String, required: Boolean = false): T?(source)

Retrieves a value from the context with runtime type checking.

Return

the value cast to type T, or null if the key doesn't exist and required is false

Parameters

key

the key to look up

required

if true, throws an exception when the key is not found; defaults to false

Throws

if required is true and the key is not found

if the value exists but is not of type T