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