Class Session
java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.sessions.Session
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddEvents(Collection<Event> events) appName()static Session.Builderbuilder(SessionKey sessionKey) Creates a newSession.Builderwith the given session key.static Session.Builderevents()Deprecated.static Sessiondoubleid()com.google.common.collect.ImmutableList<Event> Returns a thread-safe, immutable snapshot of the session's events, synchronizing on the backingevents()list.voidlastUpdateTime(Instant lastUpdateTime) Returns the session key.state()toString()userId()Methods inherited from class JsonBaseModel
fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonStringModifier and TypeMethodDescriptionstatic <T extends JsonBaseModel>
TfromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz) Deserializes a JsonNode to an object of the given type.static <T extends JsonBaseModel>
TfromJsonString(String jsonString, Class<T> clazz) Deserializes a Json string to an object of the given type.static com.fasterxml.jackson.databind.ObjectMapperReturns the mutable ObjectMapper instance used by ADK.toJson()Serializes this object (i.e., the ObjectMappper instance used by ADK) to a Json string.protected static com.fasterxml.jackson.databind.JsonNodetoJsonNode(Object object) Serializes an object to a JsonNode.static StringtoJsonString(Object object) Serializes an object to a Json string.
-
Method Details
-
builder
-
builder
Creates a newSession.Builderwith the given session key. -
sessionKey
Returns the session key. -
id
-
state
-
events
Deprecated.PreferimmutableEvents()when reading or iterating over events (to avoidConcurrentModificationException), andaddEvent(Event)oraddEvents(Collection)when appending events.Returns the mutable list of events backing this session, which also serves as the monitor for all event-helper synchronization. -
immutableEvents
Returns a thread-safe, immutable snapshot of the session's events, synchronizing on the backingevents()list. Use this method whenever reading, iterating, streaming, filtering, or slicing (List.subList(int, int)) session events to avoidConcurrentModificationExceptionunder concurrent modifications. -
addEvent
-
addEvents
-
appName
-
userId
-
lastUpdateTime
-
lastUpdateTime
-
getLastUpdateTimeAsDouble
public double getLastUpdateTimeAsDouble() -
toString
-
fromJson
-
immutableEvents()when reading or iterating over events (to avoidConcurrentModificationException), andaddEvent(Event)oraddEvents(Collection)when appending events.