com.alogic.xscript.doc.XsObject.getArrayChild()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中com.alogic.xscript.doc.XsObject.getArrayChild()方法的一些代码示例,展示了XsObject.getArrayChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XsObject.getArrayChild()方法的具体详情如下:
包路径:com.alogic.xscript.doc.XsObject
类名称:XsObject
方法名:getArrayChild

XsObject.getArrayChild介绍

[英]获取数组形式的子节点
[中]获取数组形式的子节点

代码示例

代码示例来源:origin: anylogic/alogic

protected void onExecute(XsObject root,XsObject current, LogicletContext ctx, ExecuteWatcher watcher) {
    String tagValue = ctx.transform(tag);
    if (StringUtils.isNotEmpty(tagValue)){
      XsArray array = current.getArrayChild(tagValue, true);
      try {
        ctx.setObject(id, array);
        super.onExecute(root, current, ctx, watcher);
      }finally{
        ctx.removeObject(id);
      }
    }
  }        
}

代码示例来源:origin: anylogic/alogic

content.put(tagValue, result);
}else{
  XsArray array = current.getArrayChild(tagValue, true);

代码示例来源:origin: anylogic/alogic

content.put(tagValue, result);
}else{
  XsArray array = current.getArrayChild(tagValue, true);

代码示例来源:origin: anylogic/alogic

child.addProperty("name", "ddd");
XsArray array = doc.getArrayChild("array", true);

代码示例来源:origin: anylogic/alogic

@Override
public Object nodeFound(Object cookies,
    TreeNode<String> node, int depth) {
  XsObject parent = (XsObject)cookies;                        
  XsArray list = parent.getArrayChild(itemTag, true);						
  XsObject newChild = list.newObject();    
  
  ctx.SetValue("$tree-id", node.getId());
  ctx.SetValue("$tree-parent", node.getParentId());
  ctx.SetValue("$tree-data", node.getData());
  
  self.onSuperExecute(root, newChild, ctx, watcher);                        
  list.add(newChild);
  return newChild;
}

代码示例来源:origin: anylogic/alogic

public static void main(String[] args){
  XsObject doc = new JsonObject("root",new HashMap<String,Object>());
  
  doc.addProperty("id", "alogic");
  doc.addProperty("name", "eason");
  
  XsObject child = doc.getObjectChild("child", true);
  child.addProperty("id", "child");
  child.addProperty("name", "ddd");
  
  XsArray array = doc.getArrayChild("array", true);
  
  XsObject item = array.newObject();
  item.addProperty("id", "ddd");
  array.add(item);
  
  item = array.newObject();
  item.addProperty("id", "dddd");
  array.add(item);
  
  XsPrimitiveArray array2 = doc.getPrimitiveArrayChild("array2", true);
  array2.add("dddd");
  array2.add(1000);
  
  JsonProvider provider = JsonProviderFactory.createProvider();
  System.out.println(provider.toJson(doc.getContent()));
}

相关文章