private static int validFlowRuleValue(String paramValue,
            StringBuilder sBuffer,
            ProcessResult result) {
        int ruleCnt = 0;
        paramValue = paramValue.trim();
        List<Integer> ruleTypes = Arrays.asList(0, 1, 2, 3);
        FlowCtrlRuleHandler flowCtrlRuleHandler =
                new FlowCtrlRuleHandler(true);
        Map<Integer, List<FlowCtrlItem>> flowCtrlItemMap;
        try {
            flowCtrlItemMap =
                    flowCtrlRuleHandler.parseFlowCtrlInfo(paramValue);
        } catch (Throwable e) {
            result.setFailResult(sBuffer.append("Parse parameter ")
                    .append(WebFieldDef.FLOWCTRLSET.name)
                    .append(" failure: '").append(e.toString()).toString());
            sBuffer.delete(0, sBuffer.length());
            return 0;
        }
        sBuffer.append("[");
        for (Integer typeId : ruleTypes) {
            if (typeId != null) {
                int rules = 0;
                List<FlowCtrlItem> flowCtrlItems = flowCtrlItemMap.get(typeId);
                if (flowCtrlItems != null) {
                    if (ruleCnt++ > 0) {
                        sBuffer.append(",");
                    }
                    sBuffer.append("{\"type\":").append(typeId.intValue()).append(",\"rule\":[");
                    for (FlowCtrlItem flowCtrlItem : flowCtrlItems) {
                        if (flowCtrlItem != null) {
                            if (rules++ > 0) {
                                sBuffer.append(",");
                            }
                            sBuffer = flowCtrlItem.toJsonString(sBuffer);
                        }
                    }
                    sBuffer.append("]}");
                }
            }
        }
        sBuffer.append("]");
        result.setSuccResult(sBuffer.toString());
        sBuffer.delete(0, sBuffer.length());
        return ruleCnt;
    }
translate rule info to json format string

@param paramCntr   the parameter name
@param defValue    the default value
@param sBuffer     string buffer
@param result      process result
@return the count of flow control rule
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/utils/WebParameterUtils.java