Package com.embabel.chat.support
Class InMemoryConversation
-
- All Implemented Interfaces:
-
com.embabel.chat.Conversation,com.embabel.common.core.Identified,com.embabel.common.core.StableIdentified,com.embabel.common.core.types.HasInfoString
public final class InMemoryConversation implements Conversation
Simple in-memory implementation of Conversation for testing and ephemeral use cases.
-
-
Field Summary
Fields Modifier and Type Field Description private final List<Message>messagesprivate final Stringidprivate final AssetTrackerassetTracker
-
Constructor Summary
Constructors Constructor Description InMemoryConversation(List<Message> messages, String id, Boolean persistent, AssetTracker assets)InMemoryConversation(List<Message> messages, String id, Boolean persistent)InMemoryConversation(List<Message> messages, String id)InMemoryConversation(List<Message> messages)InMemoryConversation()
-
Method Summary
Modifier and Type Method Description List<Message>getMessages()Messages in the conversation in chronological order. StringgetId()AssetTrackergetAssetTracker()Assets tracked in the conversation. MessageaddMessage(Message message)Modify the state of this conversation Return the newly added message for convenience Booleanpersistent()Conversationlast(Integer n)Create a nonpersistent conversation with the last n messages from this conversation. -
-
Constructor Detail
-
InMemoryConversation
InMemoryConversation(List<Message> messages, String id, Boolean persistent, AssetTracker assets)
-
InMemoryConversation
InMemoryConversation()
-
-
Method Detail
-
getMessages
List<Message> getMessages()
Messages in the conversation in chronological order. Visible to user.
-
getAssetTracker
AssetTracker getAssetTracker()
Assets tracked in the conversation.
-
addMessage
Message addMessage(Message message)
Modify the state of this conversation Return the newly added message for convenience
-
persistent
Boolean persistent()
-
last
Conversation last(Integer n)
Create a nonpersistent conversation with the last n messages from this conversation.
-
-
-
-