com.alogic.xscript.plugins.Obj Maven / Gradle / Ivy
package com.alogic.xscript.plugins;
import org.apache.commons.lang3.StringUtils;
import com.alogic.xscript.ExecuteWatcher;
import com.alogic.xscript.Logiclet;
import com.alogic.xscript.LogicletContext;
import com.alogic.xscript.doc.XsObject;
import com.anysoft.util.Properties;
/**
* 在当前文档增加一个对象
*
* @author duanyy
*
* @version 1.6.8.14 [20170509 duanyy]
* - 增加xscript的中间文档模型,以便支持多种报文协议
*
*/
public class Obj extends Segment {
protected String tag = "data";
public Obj(String tag, Logiclet p) {
super(tag, p);
}
@Override
public void configure(Properties p){
super.configure(p);
tag = p.GetValue("tag", tag, false, true);
}
protected void onExecute(XsObject root,XsObject current, LogicletContext ctx, ExecuteWatcher watcher) {
String tagValue = ctx.transform(tag);
if (StringUtils.isNotEmpty(tagValue)){
XsObject template = current.getObjectChild(tagValue, true);
super.onExecute(root,template, ctx, watcher);
}
}
}