當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueExpression.getValueReference方法代碼示例

本文整理匯總了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);
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:17,代碼來源:AstIdentifier.java

示例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());
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:26,代碼來源:TestValueExpressionImpl.java

示例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);
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:17,代碼來源:AstIdentifier.java

示例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());
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:28,代碼來源:TestValueExpressionImpl.java

示例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());
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:29,代碼來源:TestValueExpressionImpl.java


注:本文中的javax.el.ValueExpression.getValueReference方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。