当前位置: 首页 > 工具软件 > Jison > 使用案例 >

递归解析复杂嵌套jison

红鸿运
2023-12-01

/**
* @param i 递归json
* @param paramInfo
* @param stringBuilder
*/
private static void recursion(int i ,ParamInfo paramInfo,StringBuilder stringBuilder) {
if (paramInfo == null){
return;
}
for (int j = 0; j < i; j++) {
stringBuilder.append("+");
}
stringBuilder.append(“L”);
setParam(paramInfo);
stringBuilder.append((MarkDownTool.tableBody(
paramInfo.getParamName(),paramInfo.getType(),paramInfo.getLength().toString(),paramInfo.getDesc(),paramInfo.getExample())));
//stringBuilder.append(MarkDownTool.tableBody(“name”,“type”,“length”.toString(),“desc”,“example”));
List children = paramInfo.getChildren();
if (CollectionUtils.isEmpty(children)){
return;
}
for (ParamInfo child : children) {
recursion(i+1,child,stringBuilder);
}

 类似资料: