Java表达式解析引擎 SimpleEL

fmms 12年前
     <p>Simple EL是一个表达式解析引擎。它将表达式解析分成四个部分:预处理、编译、缓存和执行。这四个步骤任意一部分都可以替换,类似设计模式中的Template Method。</p>    <p>缺省的实现是:将表达式处理成Java Source,调用Tools.jar的Javac API动态编译,缓存变异后反射得到的实例,使得表达式的解析速度和Java静态编译的速度接近。</p>    <p>这是一个性能极致、扩展性良好的表达式解析引擎。</p>    <p>介绍项目的PPT:<a style="color:#006699;text-decoration:underline;" href="/misc/goto?guid=4959517409707439034" target="_blank">http://code.alibabatech.com/svn/SimpleEL/trunk/doc/SimpleEL.pptx</a> <br /> SVN:<a style="color:#006699;text-decoration:underline;" href="/misc/goto?guid=4959517409783596379" target="_blank">http://code.alibabatech.com/svn/SimpleEL</a> <br /> JIRA:<a style="color:#006699;text-decoration:underline;" href="/misc/goto?guid=4959517409878543324" target="_blank">http://code.alibabatech.com/jira/browse/SIMPLEEL</a> <br /> wiki:<a style="color:#006699;text-decoration:underline;" href="/misc/goto?guid=4959517410095795202" target="_blank">http://code.alibabatech.com/wiki/display/SimpleEL/Home</a> <br /> <br /> 使用范例: </p>    <pre class="brush:java; toolbar: true; auto-links: false;">import com.alibaba.simpleEL.eval.DefaultExpressEvalService;   import com.alibaba.simpleEL.preprocess.DefaultVariantResolver.Type;      DefaultExpressEvalService service = new DefaultExpressEvalService();   service.regsiterVariant(Type.Integer, "a", "b"); // 注册两个类型为Integer的变量      Map ctx = new HashMap();   ctx.put("a", 3);   ctx.put("b", 4);      Assert.assertEquals(7, service.eval(ctx, "@a + @b"));  </pre>    <p></p>