企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 对象序列化成数组 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-12-16 17:08:47 <br/> * * @param bean * 入参|对象|{@link Object} * @param types * 出参|对象字节码|{@link byte} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "对象序列化成数组", style = "判断型", type = "同步组件", comment = "将对象序列化为byte数组", version = "1.0.0", deprecated = false, author = "admin", date = "2020-12-16 05:08:47") @InParams(param = {@Param(name = "bean", comment = "对象", type = Object.class)}) @OutParams(param = {@Param(name = "types", comment = "对象字节码", type = byte.class)}) @Returns(returns = {@Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功")}) @Order(value = 2) public static ResultBase P_ObjectToByte(Object bean) { byte[] bytes = null; try { ByteArrayOutputStream bo = new ByteArrayOutputStream(); ObjectOutputStream oo = new ObjectOutputStream(bo); oo.writeObject(bean); bytes = bo.toByteArray(); bo.close(); oo.close(); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTB0012", "获取对象属性值集合异常:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(bytes); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/a5/bc/a5bc298f8f6b46a95c8d93da5a37991a_1869x891.png) # 参数说明及示例 ## 入口参数 对象:传入一个对象,可以是容器中的对象,也可以不是,示例: `{ "id":1, "name":"xy" }` ## 出口参数 对象字节码:把输入参数转换为字节码数组,示例: `__INNER__["byte"]`