企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 ``` /** * <b>方法描述:</b> 取容器深度 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-11 11:53:55 <br/> * * @param varobj * 入参|输入对象|{@link Object} * @param count * 出参|容器记录条数|{@link int} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "取容器深度", style = "判断型", type = "同步组件", comment = "获取容器变量或数组的大小", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-11 11:53:55") @InParams(param = {@Param(name = "varobj", comment = "输入对象", type = Object.class)}) @OutParams(param = {@Param(name = "count", comment = "容器记录条数", type = int.class)}) @Returns(returns = {@Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功")}) public static ResultBase P_itemCount(Object varobj) { if (varobj == null) { return ResultBase.newFailureResult("TPTC2008", "itemCount-参数不能为空"); } String strClz = varobj.getClass().getSimpleName(); int nRet = 0; if (varobj instanceof java.util.Map) { nRet = ((java.util.Map)varobj).size(); } else if (varobj instanceof java.util.Collection) { nRet = ((java.util.Collection)varobj).size(); } else if (varobj instanceof String) { nRet = ((String)varobj).length(); } else if ("byte[]".equals(strClz)) { nRet = ((byte[])varobj).length; } else if ("short[]".equals(strClz)) { nRet = ((short[])varobj).length; } else if ("int[]".equals(strClz)) { nRet = ((int[])varobj).length; } else if ("long[]".equals(strClz)) { nRet = ((long[])varobj).length; } else if ("char[]".equals(strClz)) { nRet = ((char[])varobj).length; } else if ("float[]".equals(strClz)) { nRet = ((float[])varobj).length; } else if ("double[]".equals(strClz)) { nRet = ((double[])varobj).length; } else if ("boolean[]".equals(strClz)) { nRet = ((boolean[])varobj).length; } else if (varobj.getClass().getName().charAt(0) == '[') { nRet = ((Object[])varobj).length; } return ResultBase.newSuccessResult(nRet); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/02/d8/02d883dc2f0ccf41f0581d7a2fd1b767_1869x892.png) # 参数说明及示例 ## 入口参数 输入对象:输入一个内部容器变量或者数组,示例: `[1,2,3,4,5]` ## 出口参数 容器记录条数:获取容器变量或数组的大小,示例: `__INNER__["result"]`