当前位置: 首页>>代码示例>>Java>>正文


Java MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING属性代码示例

本文整理汇总了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]);
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:25,代码来源:PropertyHandlerTests.java

示例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);
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:26,代码来源:PropertyHandlerTests.java

示例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));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:11,代码来源:PropertyHandlerTests.java

示例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"));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:12,代码来源:PropertyHandlerTests.java

示例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());
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:IntegrationTests.java

示例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);
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:9,代码来源:IntegrationTests.java

示例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));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:21,代码来源:PropertyAccessTests.java

示例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;
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:10,代码来源:PropertyHandlerTests.java

示例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));
}
 
开发者ID:codehaus,项目名称:mvel,代码行数:13,代码来源:PropertyHandlerTests.java


注:本文中的org.mvel2.MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。