企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 替换元素 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-11 11:52:47 <br/> * * @param list * 入参|集合|{@link java.util.List} * @param oldVal * 入参|旧值|{@link Object} * @param newVal * 入参|新值|{@link Object} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "替换元素", style = "判断型", type = "同步组件", comment = "支持List 集合元素替换", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-11 11:52:47") @InParams(param = { @Param(name = "list", comment = "集合", type = java.util.List.class), @Param(name = "oldVal", comment = "旧值", type = Object.class), @Param(name = "newVal", comment = "新值", type = Object.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_replace(List list, Object oldVal, Object newVal) { if (list == null) return ResultBase.newFailureResult("TPTC1012", "集合为空(Null)"); Collections.replaceAll(list, oldVal, newVal); return ResultBase.newSuccessResult(); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/e0/89/e0892709bf6aecf06127aa46f63efe9a_1866x888.png) # 参数说明及示例 ## 入口参数 集合:传入一个非空集合,示例: `__REQ__["list"]` 旧值:传入一个集合中存在的元素,示例: `__REQ__["old"]` 新值:传入一个想要替换旧值的值,示例: `__REQ__["new"]` > 注意:IDE 中集合和数组都以 [] 表示。