ManagedJsonHelper
@Component public class ManagedJsonHelper
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:29–109托管 JSON Helper,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed.service 包。核心成员包括 randomId、writeJson、readMap、readStringList、readObjectList、mapper。
Shared JSON and identifier helpers for the managed-agents service layer.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ManagedJsonHelper(ObjectMapper objectMapper) | 初始化 `ManagedJsonHelper` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static String randomId(String prefix)static | 设置该参数。 Generates a prefixed random identifier using 16 hex characters. |
public String writeJson(Object value) | 设置写入 JSON。 Serializes a value to JSON or returns `null` when the value is `null`. |
public Map<String, Object> readMap(String json) | 设置读取映射。 Deserializes JSON into a `Map<String, Object>`. |
public List<String> readStringList(String json) | 设置该参数。 Deserializes JSON into a list of strings. |
public List<Map<String, Object>> readObjectList(String json) | 设置读取对象列表。 Deserializes JSON into a list of object maps (session resources, etc.). |
public ObjectMapper mapper() | 返回 `mapper` 结果。 Returns the configured `ObjectMapper`. |
构造器详情Constructor Detail
ManagedJsonHelper
public ManagedJsonHelper(ObjectMapper objectMapper)
初始化 ManagedJsonHelper 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
objectMapper | ObjectMapper | 对象 Mapper(类型 `ObjectMapper`)。The object mapper. |
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:40–42方法详情Method Detail
randomId
public static String randomId(String prefix)
static
设置该参数。
Generates a prefixed random identifier using 16 hex characters.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
prefix | String | prefix(类型 `String`)。The prefix. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:45–53writeJson
public String writeJson(Object value)
设置写入 JSON。
Serializes a value to JSON or returns null when the value is null.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
value | Object | 值(类型 `Object`)。The value. |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:56–66readMap
public Map<String, Object> readMap(String json)
设置读取映射。
Deserializes JSON into a Map.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
Map<String, Object>返回映射。Returns map.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:69–79readStringList
public List<String> readStringList(String json)
设置该参数。
Deserializes JSON into a list of strings.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
List<String>返回列出。Returns list.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:82–91readObjectList
public List<Map<String, Object>> readObjectList(String json)
设置读取对象列表。
Deserializes JSON into a list of object maps (session resources, etc.).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
json | String | JSON(类型 `String`)。The json. |
List<Map<String, Object>>返回列出>。Returns list.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:94–103mapper
public ObjectMapper mapper()
返回 mapper 结果。
Returns the configured ObjectMapper.
ObjectMapper返回ObjectMapper。Returns object mapper.
源码Source
io/agentscope/builder/web/managed/service/ManagedJsonHelper.java:106–108