1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jexl;
18
19 import java.util.Map;
20
21 /***
22 * @author Dion Gillard
23 * @since 1.0
24 * Command line interface for Jexl for use in testing
25 */
26 public class Jexl {
27
28 public static void main(String[] args) {
29
30 JexlContext context = new JexlContext() {
31 public Map getVars() { return System.getProperties(); }
32 public void setVars(Map map) { }
33 };
34 try {
35 for (int i = 0; i < args.length; i++) {
36 Expression e = ExpressionFactory.createExpression(args[i]);
37 System.out.println("evaluate(" + args[i] + ") = '" + e.evaluate(context) + "'");
38 }
39 } catch (Exception e) {
40 e.printStackTrace();
41 }
42 }
43 }