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

cn.hutool.extra.expression.engine.qlexpress.QLExpressEngine Maven / Gradle / Ivy

The newest version!
package cn.hutool.extra.expression.engine.qlexpress;

import cn.hutool.extra.expression.ExpressionEngine;
import cn.hutool.extra.expression.ExpressionException;
import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;

import java.util.Collection;
import java.util.Map;

/**
 * QLExpress引擎封装
* 见:https://github.com/alibaba/QLExpress * * @author looly * @since 5.8.9 */ public class QLExpressEngine implements ExpressionEngine { private final ExpressRunner engine; /** * 构造 */ public QLExpressEngine() { engine = new ExpressRunner(); } @Override public Object eval(final String expression, final Map context, Collection> allowClassSet) { final DefaultContext defaultContext = new DefaultContext<>(); defaultContext.putAll(context); try { return engine.execute(expression, defaultContext, null, true, false); } catch (final Exception e) { throw new ExpressionException(e); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy