本文整理匯總了Java中javax.el.ValueExpression.getValueReference方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueExpression.getValueReference方法的具體用法?Java ValueExpression.getValueReference怎麽用?Java ValueExpression.getValueReference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.el.ValueExpression
的用法示例。
在下文中一共展示了ValueExpression.getValueReference方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getValueReference
import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public ValueReference getValueReference(EvaluationContext ctx) {
VariableMapper varMapper = ctx.getVariableMapper();
if (varMapper == null) {
return null;
}
ValueExpression expr = varMapper.resolveVariable(this.image);
if (expr == null) {
return null;
}
return expr.getValueReference(ctx);
}
示例2: testGetValueReference
import javax.el.ValueExpression; //導入方法依賴的package包/類
@Test
public void testGetValueReference() {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new ELContextImpl();
TesterBeanB beanB = new TesterBeanB();
beanB.setName("Tomcat");
ValueExpression var =
factory.createValueExpression(beanB, TesterBeanB.class);
context.getVariableMapper().setVariable("beanB", var);
ValueExpression ve = factory.createValueExpression(
context, "${beanB.name}", String.class);
// First check the basics work
String result = (String) ve.getValue(context);
assertEquals("Tomcat", result);
// Now check the value reference
ValueReference vr = ve.getValueReference(context);
assertNotNull(vr);
assertEquals(beanB, vr.getBase());
assertEquals("name", vr.getProperty());
}
示例3: getValueReference
import javax.el.ValueExpression; //導入方法依賴的package包/類
@Override
public ValueReference getValueReference(EvaluationContext ctx) {
VariableMapper varMapper = ctx.getVariableMapper();
if (varMapper == null) {
return null;
}
ValueExpression expr = varMapper.resolveVariable(this.image);
if (expr == null) {
return null;
}
return expr.getValueReference(ctx);
}
示例4: testGetValueReferenceVariable
import javax.el.ValueExpression; //導入方法依賴的package包/類
@Test
public void testGetValueReferenceVariable() {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new ELContextImpl();
TesterBeanB beanB = new TesterBeanB();
beanB.setName("Tomcat");
ValueExpression var =
factory.createValueExpression(beanB, TesterBeanB.class);
context.getVariableMapper().setVariable("beanB", var);
ValueExpression var2 = factory.createValueExpression(
context, "${beanB.name}", String.class);
context.getVariableMapper().setVariable("foo", var2);
ValueExpression ve = factory.createValueExpression(
context, "${foo}", ValueExpression.class);
// Now check the value reference
ValueReference vr = ve.getValueReference(context);
assertNotNull(vr);
assertEquals(beanB, vr.getBase());
assertEquals("name", vr.getProperty());
}
示例5: testBug49345
import javax.el.ValueExpression; //導入方法依賴的package包/類
@Test
public void testBug49345() {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new ELContextImpl();
TesterBeanA beanA = new TesterBeanA();
TesterBeanB beanB = new TesterBeanB();
beanB.setName("Tomcat");
beanA.setBean(beanB);
ValueExpression var =
factory.createValueExpression(beanA, TesterBeanA.class);
context.getVariableMapper().setVariable("beanA", var);
ValueExpression ve = factory.createValueExpression(
context, "${beanA.bean.name}", String.class);
// First check the basics work
String result = (String) ve.getValue(context);
assertEquals("Tomcat", result);
// Now check the value reference
ValueReference vr = ve.getValueReference(context);
assertNotNull(vr);
assertEquals(beanB, vr.getBase());
assertEquals("name", vr.getProperty());
}