com.github.obhen233.engine.Engine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of purslane-engine Show documentation
Show all versions of purslane-engine Show documentation
A rule engine,easy to expand,and easy to use.
The newest version!
package com.github.obhen233.engine;
import java.util.Map;
import com.github.obhen233.util.ExpressionUtil;
import com.github.obhen233.util.RootKeyUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.obhen233.element.Root;
import com.github.obhen233.producer.RootProducer;
public class Engine {
private static Logger logger = LoggerFactory.getLogger(Engine.class);
public static Object doExcute(Map param,String unid) throws Exception{
String key = RootKeyUtil.getkeyFromMap(param, unid);
Root root = RootProducer.getRootByKey(key);
RootKeyUtil.setRootFields(root,param);
return root.excute().getFormatMsg();
}
public static Object doExcute(Object obj,Map param) throws Exception{
return doExcute(obj.getClass(),param);
}
public static Object doExcute(Class clazz,Map param) throws Exception{
Root root = ExpressionUtil.expression2Root(clazz);
RootKeyUtil.setRootFields(root,param);
return root.excute().getFormatMsg();
}
public static Object doExcute(String expression,Map param) throws Exception{
Root root = ExpressionUtil.expression2Root(expression);
RootKeyUtil.setRootFields(root,param);
return root.excute().getFormatMsg();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy