本文整理汇总了Java中org.mvel2.MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING属性的典型用法代码示例。如果您正苦于以下问题:Java MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING属性的具体用法?Java MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING怎么用?Java MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.mvel2.MVEL
的用法示例。
在下文中一共展示了MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testListPropertyHandler4
public void testListPropertyHandler4() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
OptimizerFactory.setDefaultOptimizer("ASM");
final String[] res = new String[1];
GlobalListenerFactory.registerGetListener(new Listener() {
public void onEvent(Object context, String contextName, VariableResolverFactory variableFactory, Object value) {
System.out.println("Listener Fired:" + contextName);
res[0] = contextName;
}
});
Serializable s = MVEL.compileSetExpression("list[0]");
Base b;
MVEL.executeSetExpression(s, new Base(), "hey you");
res[0] = null;
MVEL.executeSetExpression(s, b = new Base(), "hey you");
assertEquals("set", b.list.get(0));
assertEquals("list", res[0]);
}
示例2: testSetListListener
public void testSetListListener() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
class MyListener implements Listener {
public int counter;
public void onEvent(Object context, String contextName,
VariableResolverFactory variableFactory, Object value) {
counter++;
}
}
class MyBean {
private List someList;
public List getSomeList() {
return someList;
}
}
MyListener listener = new MyListener();
GlobalListenerFactory.registerGetListener(listener);
MVEL.getProperty("someList", new MyBean());
MVEL.getProperty("someList", new MyBean());
assertEquals(2, listener.counter);
}
示例3: testListPropertyHandler2
public void testListPropertyHandler2() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
Serializable s = MVEL.compileSetExpression("list[0]");
Base b;
MVEL.executeSetExpression(s, new Base(), "hey you");
MVEL.executeSetExpression(s, b = new Base(), "hey you");
assertEquals("set", b.list.get(0));
}
示例4: testPropertyHandlerSetting
public void testPropertyHandlerSetting() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
PropertyHandlerFactory.registerPropertyHandler(WorkObject.class, new WebPropertyHandler());
Map vars = new HashMap();
WorkObject wo = new WorkObject();
vars.put("wobj", wo);
MVEL.setProperty(vars, "wobj.foo", "foobie");
assertEquals("foobie", wo.getFieldValue("foo"));
}
示例5: setUp
@Override
protected void setUp() throws Exception {
super.setUp();
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
OptimizerFactory.setDefaultOptimizer(OptimizerFactory.SAFE_REFLECTIVE);
PropertyHandlerFactory.registerPropertyHandler(MyClass.class, new NullPropertyHandler());
PropertyHandlerFactory.registerPropertyHandler(MyInterface.class, new NullPropertyHandler());
}
示例6: tearDown
@Override
protected void tearDown() throws Exception {
super.tearDown();
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = false;
PropertyHandlerFactory.unregisterPropertyHandler(MyClass.class);
PropertyHandlerFactory.unregisterPropertyHandler(MyInterface.class);
}
示例7: testMVELCompilerBoth
public void testMVELCompilerBoth() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
PropertyHandlerFactory.registerPropertyHandler(DynaBean.class, new DynaBeanPropertyHandler());
TestBean bean = new TestBean("value1");
Map<String, Object> vars = new LinkedHashMap<String, Object>();
vars.put("attr", bean);
ParserContext parserContext = new ParserContext();
Object compiled = MVEL.compileExpression("attr.value", parserContext);
assertEquals("value1", MVEL.executeExpression(compiled, null, vars));
DynaBean dyna = new LazyDynaBean();
dyna.set("value", "value2");
vars.put("attr", dyna);
assertEquals("value2", MVEL.executeExpression(compiled, null, vars));
}
示例8: testListPropertyHandler
public void testListPropertyHandler() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
assertEquals("gotcalled", PropertyAccessor.get("list[0]", base));
PropertyAccessor.set(base, "list[0]", "hey you");
assertEquals("set", base.list.get(0));
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = false;
}
示例9: testListPropertyHandler3
public void testListPropertyHandler3() {
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
OptimizerFactory.setDefaultOptimizer("ASM");
Serializable s = MVEL.compileSetExpression("list[0]");
Base b;
MVEL.executeSetExpression(s, new Base(), "hey you");
MVEL.executeSetExpression(s, b = new Base(), "hey you");
assertEquals("set", b.list.get(0));
}