记录类 SimpleSessionKey
java.lang.Object
java.lang.Record
io.agentscope.core.state.SimpleSessionKey
- 记录组件:
sessionId- the unique session identifier string
- 所有已实现的接口:
SessionKey
Default simple session identifier implementation using a single string.
This is the recommended session key for most use cases where a simple string identifier is sufficient.
Example usage:
SessionKey sessionKey = SimpleSessionKey.of("user_123");
agent.loadIfExists(session, sessionKey);
agent.saveTo(session, sessionKey);
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明final boolean指示某个其他对象是否“等于”此对象。final inthashCode()返回此对象的哈希代码值。static SimpleSessionKeyFactory method to create a SimpleSessionKey.返回sessionId记录组件的值。Returns a string identifier for this session key.toString()返回此记录类的字符串表示形式。
-
构造器详细资料
-
SimpleSessionKey
Creates a SimpleSessionKey with validation.- 参数:
sessionId- the session identifier (must not be null or blank)
-
-
方法详细资料
-
of
Factory method to create a SimpleSessionKey.- 参数:
sessionId- the session identifier- 返回:
- a new SimpleSessionKey instance
-
toIdentifier
从接口复制的说明:SessionKeyReturns a string identifier for this session key.This method is used by Session implementations to convert the session key to a string suitable for storage (e.g., as a directory name, database key, or Redis key prefix).
The default implementation uses JSON serialization. Implementations like
SimpleSessionKeyoverride this to return the session ID directly for better readability.- 指定者:
toIdentifier在接口中SessionKey- 返回:
- a string identifier for this session key
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用Objects::equals(Object,Object)进行比较。 -
sessionId
返回sessionId记录组件的值。- 返回:
sessionId记录组件的值
-