| Package | Description |
|---|---|
| ratpack.session |
Objects for providing
Session support |
| Modifier and Type | Method and Description |
|---|---|
static <T> SessionKey<T> |
SessionKey.of(Class<T> type)
Creates a key of the given type with no name.
|
static SessionKey<?> |
SessionKey.of(String name)
Creates a key of the given name with no type.
|
static <T> SessionKey<T> |
SessionKey.of(String name,
Class<T> type)
Creates a key of the given name and type.
|
static <T> SessionKey<T> |
SessionKey.ofType(String name,
T value)
Creates a key of the given name, and the type of the given object (as provided by
Object.getClass()). |
static <T> SessionKey<T> |
SessionKey.ofType(T value)
Creates a key of type of the given object (as provided by
Object.getClass()), and no name. |
| Modifier and Type | Method and Description |
|---|---|
Set<SessionKey<?>> |
SessionData.getKeys()
The keys of all objects currently in the session.
|
| Modifier and Type | Method and Description |
|---|---|
default <T> Optional<T> |
SessionData.get(SessionKey<T> key)
Fetch the object with the given key, using the
default serializer. |
<T> Optional<T> |
SessionData.get(SessionKey<T> key,
SessionSerializer serializer)
Read the object with the given key.
|
void |
SessionData.remove(SessionKey<?> key)
Removes the object with the given key, if it exists.
|
default <T> T |
SessionData.require(SessionKey<T> key)
Like
SessionData.get(SessionKey), but throws NoSuchElementException on the absence of a value. |
default <T> T |
SessionData.require(SessionKey<T> key,
SessionSerializer serializer)
Like
SessionData.get(SessionKey, SessionSerializer), but throws NoSuchElementException on the absence of a value. |
default <T> void |
SessionData.set(SessionKey<T> key,
T value)
Sets the value for the given key, using the
default serializer. |
<T> void |
SessionData.set(SessionKey<T> key,
T value,
SessionSerializer serializer)
Sets the value for the given key.
|