01: package org.mvel.tests.main;
02:
03: import org.mvel.MVEL;
04: import org.mvel.MVELRuntime;
05: import org.mvel.debug.DebugTools;
06: import org.mvel.optimizers.OptimizerFactory;
07: import org.mvel.integration.VariableResolverFactory;
08: import org.mvel.integration.impl.MapVariableResolverFactory;
09:
10: import java.io.Serializable;
11: import java.util.HashMap;
12:
13: public class ExampleTest {
14: public static class Person {
15: private String name;
16: private int age;
17:
18: public String getName() {
19: return name;
20: }
21:
22: public void setName(String name) {
23: this .name = name;
24: }
25:
26: public int getAge() {
27: return age;
28: }
29:
30: public void setAge(int age) {
31: this .age = age;
32: }
33: }
34:
35: public static void main(String[] args) {
36: Person per = new Person();
37: per.setName("John Doe");
38: per.setAge(37);
39:
40: // HashMap map = new HashMap();
41: // map.put("foo", per);
42:
43: /**
44: * Integration starts
45: */
46:
47: Object o = MVEL.eval("name.toUpperCase()", per);
48: // Object o = MVEL.executeExpression(s, per);
49:
50: System.out.println(o);
51: }
52: }
|