public class XatkitSession extends Object
A XatkitSession is bound to a user, and holds all the volatile information related to the current
conversation. A XatkitSession contains a RuntimeContexts, that represents the contextual variables
of the current conversation.
| Constructor and Description |
|---|
XatkitSession(String sessionId)
Constructs a new, empty
XatkitSession with the provided sessionId. |
XatkitSession(String sessionId,
Configuration configuration)
|
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String key)
Retrieves the session value associated to the provided
key. |
Configuration |
getConfiguration()
Returns the
Configuration defining the session behavior. |
RuntimeContexts |
getRuntimeContexts()
Returns the session's
RuntimeContexts holding context-related variables. |
String |
getSessionId()
Returns the unique identifier of the
XatkitSession. |
Map<String,Object> |
getSessionVariables()
Returns a
Map containing the session variables. |
void |
merge(XatkitSession other)
Merges this
XatkitSession with the provided other. |
void |
store(String key,
Object value)
Store the provided
value with the given key as a session variable. |
void |
storeList(String key,
Object value)
|
String |
toString()
Returns a
String representation of the session. |
public XatkitSession(String sessionId)
XatkitSession with the provided sessionId.
See XatkitSession(String, Configuration) to construct a XatkitSession with a given
Configuration.sessionId - the unique identifier of the XatkitSessionpublic XatkitSession(String sessionId, Configuration configuration)
XatkitSession with the provided sessionId and configuration.
This constructor forwards the provided Configuration to the underlying RuntimeContexts and can
be used to customize RuntimeContexts properties.
sessionId - the unique identifier of the XatkitSessionconfiguration - the Configuration parameterizing the XatkitSessionNullPointerException - if the provided sessionId or configuration is nullpublic String getSessionId()
XatkitSession.XatkitSessionpublic RuntimeContexts getRuntimeContexts()
RuntimeContexts holding context-related variables.RuntimeContexts holding context-related variablespublic Configuration getConfiguration()
Configuration defining the session behavior.Configuration defining the session behaviorpublic void store(String key, Object value)
value with the given key as a session variable.
Session-related variables are persistent across intent and events, and can contain any Object. They
are used to store results of specific actions, or set global variables that can be accessed along the
conversation.
Note: this method erases the previous value associated to the provided key with the new one.
key - the key to store and retrieve the provided valuevalue - the value to storeNullPointerException - if the provided key is nullpublic void storeList(String key, Object value)
value in the List associated to the provided key as a session
variable.
This method creates a new List with the provided value if the session variables do not contain
any record associated to the provided key.
Note: if the XatkitSession contains a single-valued entry for the provided key this
value will be erased and replaced by the created List.
public Map<String,Object> getSessionVariables()
Map containing the session variables.Map containing the session variablespublic void merge(XatkitSession other)
XatkitSession with the provided other.other - the XatkitSession to merge in the current onepublic Object get(String key)
key.key - the key to retrieve the value forkey if it exists, null otherwiseCopyright © 2020 SOM Research Lab. All rights reserved.