本文整理汇总了Java中org.mvel2.MVEL.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java MVEL.getProperty方法的具体用法?Java MVEL.getProperty怎么用?Java MVEL.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mvel2.MVEL
的用法示例。
在下文中一共展示了MVEL.getProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValue
import org.mvel2.MVEL; //导入方法依赖的package包/类
public Object getValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory) {
if (!conversionType.isAssignableFrom(ctx.getClass())) {
if (nextNode != null) {
return nextNode.getValue(MVEL.getProperty(propertyName, ctx), elCtx, variableFactory);
}
else {
return MVEL.getProperty(propertyName, ctx);
}
}
try {
if (nextNode != null) {
return nextNode.getValue(propertyHandler.getProperty(propertyName, ctx, variableFactory), elCtx, variableFactory);
}
else {
return propertyHandler.getProperty(propertyName, ctx, variableFactory);
}
}
catch (Exception e) {
throw new CompileException("unable to access field", e);
}
}
示例2: testSetListListener
import org.mvel2.MVEL; //导入方法依赖的package包/类
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);
}