Builder
public static class Builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:205–309ToolExecutionContext的构建器。位于 io.agentscope.core.tool 包。核心成员包括 register、addStore、build。
Builder for ToolExecutionContext.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder register(Object object) | 设置注册。 Registers an object by its runtime type (singleton pattern). |
public T Builder register(Class<T> type, T object) | 执行注册相关操作。 Registers an object with explicit type (e.g., by interface). |
public T Builder register(String key, Class<T> type, T object) | 执行注册相关操作。 Registers an object with key and type (multi-instance pattern). |
public Builder register(String key, Object object) | 执行注册相关操作。 Registers an object with key (type inferred from runtime). |
public Builder addStore(ContextStore store) | 添加存储。 Adds a single store to the store list. |
public ToolExecutionContext build() | 构建ToolExecutionContext。 Builds the ToolExecutionContext. |
方法详情Method Detail
register
public Builder register(Object object)
设置注册。
Registers an object by its runtime type (singleton pattern).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
object | Object | 对象到注册。The object to register |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:217–220register
public T Builder register(Class<T> type, T object)
执行注册相关操作。
Registers an object with explicit type (e.g., by interface).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | Class<T> | 类型密钥。The type key |
object | T | 对象到注册。The object to register |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:230–233register
public T Builder register(String key, Class<T> type, T object)
执行注册相关操作。
Registers an object with key and type (multi-instance pattern).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key identifying this instance |
type | Class<T> | 类型密钥。The type key |
object | T | 对象到注册。The object to register |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:244–247register
public Builder register(String key, Object object)
执行注册相关操作。
Registers an object with key (type inferred from runtime).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | String | 键(类型 `String`)。The key identifying this instance |
object | Object | 对象到注册。The object to register |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:256–259addStore
public Builder addStore(ContextStore store)
添加存储。
Adds a single store to the store list.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | ContextStore | 上下文存储到添加。The context store to add |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:283–289build
public ToolExecutionContext build()
构建ToolExecutionContext。
Builds the ToolExecutionContext.
ToolExecutionContext一种新的ToolExecutionContext。A new ToolExecutionContext
源码Source
io/agentscope/core/tool/ToolExecutionContext.java:296–308