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


Java ValueReference类代码示例

本文整理汇总了Java中javax.el.ValueReference的典型用法代码示例。如果您正苦于以下问题:Java ValueReference类的具体用法?Java ValueReference怎么用?Java ValueReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ValueReference类属于javax.el包,在下文中一共展示了ValueReference类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValueReference

import javax.el.ValueReference; //导入依赖的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.ValueReference; //导入依赖的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.ValueReference; //导入依赖的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: getValueReference

import javax.el.ValueReference; //导入依赖的package包/类
public ValueReference getValueReference(ELContext elContext) {
    InterceptingResolver resolver = new InterceptingResolver(elContext.getELResolver());
    try {
        expression.setValue(decorateELContext(elContext, resolver), null);
    } catch (ELException ele) {
        return null;
    }
    ValueReference reference = resolver.getValueReference();
    if (reference != null) {
        Object base = reference.getBase();
        if (base instanceof CompositeComponentExpressionHolder) {
            ValueExpression ve = ((CompositeComponentExpressionHolder) base)
                    .getExpression((String) reference.getProperty());
            if (ve != null) {
                this.expression = ve;
                reference = getValueReference(elContext);
            }
        }
    }
    return reference;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:22,代码来源:ValueExpressionAnalyzer.java

示例5: testGetValueReference

import javax.el.ValueReference; //导入依赖的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:WhiteBearSolutions,项目名称:WBSAirback,代码行数:26,代码来源:TestValueExpressionImpl.java

示例6: getValueReference

import javax.el.ValueReference; //导入依赖的package包/类
/**
 * @since EL 2.2
 */
@Override
public ValueReference getValueReference(EvaluationContext ctx) {
    // Check this is a reference to a base and a property
    if (this.children.length > 2 &&
            this.jjtGetChild(2) instanceof AstMethodParameters) {
        // This is a method call
        return null;
    }
    Target t = getTarget(ctx);
    return new ValueReference(t.base, t.property);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:AstValue.java

示例7: getValueReference

import javax.el.ValueReference; //导入依赖的package包/类
/**
 * @since EL 2.2
 */
@Override
public ValueReference getValueReference(ELContext context) {
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
            this.varMapper);
    return this.getNode().getValueReference(ctx);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:ValueExpressionImpl.java

示例8: testGetValueReferenceVariable

import javax.el.ValueReference; //导入依赖的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

示例9: testBug49345

import javax.el.ValueReference; //导入依赖的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

示例10: getValueReference

import javax.el.ValueReference; //导入依赖的package包/类
/**
 * @since EL 2.2
 */
@Override
public ValueReference getValueReference(EvaluationContext ctx) {
	// Check this is a reference to a base and a property
	if (this.children.length > 2 && this.jjtGetChild(2) instanceof AstMethodParameters) {
		// This is a method call
		return null;
	}
	Target t = getTarget(ctx);
	return new ValueReference(t.base, t.property);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:14,代码来源:AstValue.java

示例11: readAnnotations

import javax.el.ValueReference; //导入依赖的package包/类
/**
 * Which annotations are given to an object described by an EL expression?
 *
 * @param p_expression
 *            EL expression of the JSF bean attribute
 * @return null if there are no annotations, or if they cannot be accessed
 */
public static Annotation[] readAnnotations(ValueExpression p_expression, UIComponent p_component) {
	FacesContext context = FacesContext.getCurrentInstance();
	ELContext elContext = context.getELContext();
	try {
		ValueReference valueReference = p_expression.getValueReference(elContext);
		Object base;
		if (null == valueReference) {
			base = evaluteBaseForMojarra(elContext, p_expression);
		} else {
			base = valueReference.getBase();
		}
		if (null == base) {
			return null;
		}
		Field declaredField = getField(base, p_expression.getExpressionString());
		if (null != declaredField) {
			return declaredField.getAnnotations();
		}
		Method getter = getGetter(base, p_expression.getExpressionString());
		if (null != getter) {
			return getter.getAnnotations();
		}
	} catch (PropertyNotFoundException ex) {
		// this happens if a bean is null. That's a legal state, so suffice it to return no annotation.
	}
	return null;
}
 
开发者ID:TheCoder4eu,项目名称:BootsFaces-OSP,代码行数:35,代码来源:ELTools.java

示例12: setValue

import javax.el.ValueReference; //导入依赖的package包/类
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
    if (base != null && property != null) {
        context.setPropertyResolved(true);
        valueReference = new ValueReference(base, property.toString());
    }
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:8,代码来源:ValueExpressionAnalyzer.java

示例13: testBug49345

import javax.el.ValueReference; //导入依赖的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:WhiteBearSolutions,项目名称:WBSAirback,代码行数:29,代码来源:TestValueExpressionImpl.java

示例14: getValueReference

import javax.el.ValueReference; //导入依赖的package包/类
/**
 * @since EL 2.2
 */
@Override
public ValueReference getValueReference(EvaluationContext ctx) {
    return null;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:SimpleNode.java


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