表達式語言引擎 Commons JEXL
Java Expression Language (JEXL) 是一個表達式語言引擎,可以用來在應用或者框架中使用。JEXL 受Velocity 和 JSP 標簽庫 1.1 (JSTL) 的影響而產生的。需要注意的是, JEXL 并不時 JSTL 中的表達式語言的實現。
Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP). While inspired by JSTL EL, it must be noted that JEXL is not a compatible implementation of EL as defined in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of these specifications, see the Commons EL project.
示例代碼:
// Create an expression object String jexlExp = "foo.innerFoo.bar()"; Expression e = ExpressionFactory.createExpression( jexlExp ); // Create a context and add data JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); // Now evaluate the expression, getting the result Object o = e.evaluate(jc);
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!