javax.el.ValueReference Java Examples
The following examples show how to use
javax.el.ValueReference.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 6 votes |
@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); }
Example #2
Source File: TestValueExpressionImpl.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Test public void testGetValueReference() { ExpressionFactory factory = ExpressionFactory.newInstance(); ELContext context = new ELContextImpl(factory); 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); Assert.assertEquals("Tomcat", result); // Now check the value reference ValueReference vr = ve.getValueReference(context); Assert.assertNotNull(vr); Assert.assertEquals(beanB, vr.getBase()); Assert.assertEquals("name", vr.getProperty()); }
Example #3
Source File: TestValueExpressionImpl.java From tomcatsrc with Apache License 2.0 | 6 votes |
@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()); }
Example #4
Source File: AstIdentifier.java From tomcatsrc with Apache License 2.0 | 6 votes |
@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); }
Example #5
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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); }
Example #6
Source File: TestValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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()); }
Example #7
Source File: ValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(ELContext context) { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().getValueReference(ctx); }
Example #8
Source File: ELTools.java From BootsFaces-OSP with Apache License 2.0 | 5 votes |
/** * 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; }
Example #9
Source File: TestValueExpressionImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
@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()); }
Example #10
Source File: TestValueExpressionImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
@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()); }
Example #11
Source File: ValueExpressionImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(ELContext context) { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); return this.getNode().getValueReference(ctx); }
Example #12
Source File: AstValue.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * @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); }
Example #13
Source File: TestValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@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()); }
Example #14
Source File: TestValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@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()); }
Example #15
Source File: AstValue.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * @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); }
Example #16
Source File: TestValueExpressionImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Test public void testBug49345() { ExpressionFactory factory = ExpressionFactory.newInstance(); ELContext context = new ELContextImpl(factory); 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); Assert.assertEquals("Tomcat", result); // Now check the value reference ValueReference vr = ve.getValueReference(context); Assert.assertNotNull(vr); Assert.assertEquals(beanB, vr.getBase()); Assert.assertEquals("name", vr.getProperty()); }
Example #17
Source File: TestValueExpressionImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Test public void testGetValueReferenceVariable() { ExpressionFactory factory = ExpressionFactory.newInstance(); ELContext context = new ELContextImpl(factory); 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); Assert.assertNotNull(vr); Assert.assertEquals(beanB, vr.getBase()); Assert.assertEquals("name", vr.getProperty()); }
Example #18
Source File: ValueExpressionImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(ELContext context) { EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, this.varMapper); context.notifyBeforeEvaluation(getExpressionString()); ValueReference result = this.getNode().getValueReference(ctx); context.notifyAfterEvaluation(getExpressionString()); return result; }
Example #19
Source File: AstValue.java From Tomcat8-Source-Read with MIT License | 5 votes |
/** * @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); }
Example #20
Source File: SimpleNode.java From Tomcat8-Source-Read with MIT License | 4 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(EvaluationContext ctx) { return null; }
Example #21
Source File: SimpleNode.java From tomcatsrc with Apache License 2.0 | 4 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(EvaluationContext ctx) { return null; }
Example #22
Source File: SimpleNode.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
/** * @since EL 2.2 */ @Override public ValueReference getValueReference(EvaluationContext ctx) { return null; }
Example #23
Source File: Node.java From tomcatsrc with Apache License 2.0 | 2 votes |
/** * @since EL 2.2 */ public ValueReference getValueReference(EvaluationContext ctx);
Example #24
Source File: Node.java From Tomcat7.0.67 with Apache License 2.0 | 2 votes |
/** * @since EL 2.2 */ public ValueReference getValueReference(EvaluationContext ctx);
Example #25
Source File: Node.java From Tomcat8-Source-Read with MIT License | 2 votes |
/** * @since EL 2.2 */ public ValueReference getValueReference(EvaluationContext ctx);