public class Session
A namespace object for attaching your session objects.
WARNING: you can only read the property while holding the Vaadin UI lock (that is, there is current session available).
| Modifier and Type | Field and Description |
|---|---|
static Session |
INSTANCE
A namespace object for attaching your session objects.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
get(java.lang.String key)
Returns the attribute stored in this session under given key.
|
<T> T |
get(kotlin.reflect.KClass<T> key)
Returns the attribute stored in this session under given key.
|
com.vaadin.server.VaadinSession |
getCurrent()
Returns the current VaadinSession; fails if there is no session, most probably since we are not in the UI thread.
|
<T extends Serializable> |
getOrPut(kotlin.reflect.KClass<T> key,
kotlin.jvm.functions.Function0<? extends T> defaultValue)
Retrieves the class stored under its class name as the key from the session; if it's not yet there calls defaultValue block to create it.
|
void |
set(java.lang.String key,
java.lang.Object value)
Stores given value under given key in a session. Removes the mapping if value is null
|
<T> void |
set(kotlin.reflect.KClass<T> key,
T value)
Stores given value under given key in a session. Removes the mapping if value is null
|
public static Session INSTANCE
A namespace object for attaching your session objects.
WARNING: you can only read the property while holding the Vaadin UI lock (that is, there is current session available).
public com.vaadin.server.VaadinSession getCurrent()
Returns the current VaadinSession; fails if there is no session, most probably since we are not in the UI thread.
public java.lang.Object get(java.lang.String key)
Returns the attribute stored in this session under given key.
key - the keypublic <T> T get(kotlin.reflect.KClass<T> key)
Returns the attribute stored in this session under given key.
key - the keypublic void set(java.lang.String key,
java.lang.Object value)
Stores given value under given key in a session. Removes the mapping if value is null
value - the value to store, may be null to remove the mapping.public <T> void set(kotlin.reflect.KClass<T> key,
T value)
Stores given value under given key in a session. Removes the mapping if value is null
key - the keyvalue - the value to store, may be null ifpublic <T extends Serializable> T getOrPut(kotlin.reflect.KClass<T> key, kotlin.jvm.functions.Function0<? extends T> defaultValue)
Retrieves the class stored under its class name as the key from the session; if it's not yet there calls defaultValue block to create it.