All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alogic.xscript.plugins.Lowercase Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.alogic.xscript.plugins;

import org.apache.commons.lang3.StringUtils;
import com.alogic.xscript.AbstractLogiclet;
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;
import com.anysoft.util.PropertiesConstants;

/**
 * 将取值全部转为小写,并设置为变量
 * @author duanyy
 *
 * @version 1.6.8.4 [20170329 duanyy] 
* - 只取context变量,不取文档属性变量
* * @version 1.6.8.14 [20170509 duanyy]
* - 增加xscript的中间文档模型,以便支持多种报文协议
* */ public class Lowercase extends AbstractLogiclet { protected String id; protected String value; public Lowercase(String tag, Logiclet p) { super(tag, p); } public void configure(Properties p){ super.configure(p); id = PropertiesConstants.getString(p,"id","",true); value = p.GetValue("value", "", false, true); } @Override protected void onExecute(XsObject root,XsObject current, LogicletContext ctx, ExecuteWatcher watcher) { if (StringUtils.isNotEmpty(id)){ ctx.SetValue(id, ctx.transform(value).toLowerCase()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy