javax.el.VariableMapper Java Examples
The following examples show how to use
javax.el.VariableMapper.
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 tomcatsrc with Apache License 2.0 | 6 votes |
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.getType(ctx.getELContext()); } } ctx.setPropertyResolved(false); Class<?> result = ctx.getELResolver().getType(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #2
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 #3
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Override public void setValue(EvaluationContext ctx, Object value) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { expr.setValue(ctx.getELContext(), value); return; } } ctx.setPropertyResolved(false); ctx.getELResolver().setValue(ctx, null, this.image, value); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } }
Example #4
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Override public boolean isReadOnly(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.isReadOnly(ctx.getELContext()); } } ctx.setPropertyResolved(false); boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #5
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.getType(ctx.getELContext()); } } ctx.setPropertyResolved(false); Class<?> result = ctx.getELResolver().getType(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #6
Source File: RuleEvaluator.java From proctor with Apache License 2.0 | 6 votes |
@Nonnull ELContext createELContext(@Nonnull final VariableMapper variableMapper) { return new ELContext() { @Nonnull @Override public ELResolver getELResolver() { return elResolver; } @Nonnull @Override public FunctionMapper getFunctionMapper() { return functionMapper; } @Nonnull @Override public VariableMapper getVariableMapper() { return variableMapper; } }; }
Example #7
Source File: TesterVariableMapperImpl.java From Tomcat8-Source-Read with MIT License | 6 votes |
@Test public void testSetVariable01() { ExpressionFactory factory = ELManager.getExpressionFactory(); ELContext context = new TesterELContext(); ValueExpression ve1 = factory.createValueExpression(context, "${1}", int.class); ValueExpression ve2 = factory.createValueExpression(context, "${2}", int.class); ValueExpression ve3 = factory.createValueExpression(context, "${3}", int.class); VariableMapper mapper = new VariableMapperImpl(); mapper.setVariable("var1", ve1); mapper.setVariable("var2", ve2); mapper.setVariable("var3", ve3); mapper.setVariable("var2", null); Assert.assertEquals(ve1, mapper.resolveVariable("var1")); Assert.assertNull(mapper.resolveVariable("var2")); Assert.assertEquals(ve3, mapper.resolveVariable("var3")); }
Example #8
Source File: CdiResolver.java From flowable-engine with Apache License 2.0 | 6 votes |
public CdiResolver() { context = new javax.el.ELContext() { @Override public VariableMapper getVariableMapper() { return null; } @Override public FunctionMapper getFunctionMapper() { return null; } @Override public javax.el.ELResolver getELResolver() { return getWrappedResolver(); } }; }
Example #9
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override public Class<?> getType(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.getType(ctx.getELContext()); } } ctx.setPropertyResolved(false); Class<?> result = ctx.getELResolver().getType(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #10
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override public boolean isReadOnly(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.isReadOnly(ctx.getELContext()); } } ctx.setPropertyResolved(false); boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #11
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override public void setValue(EvaluationContext ctx, Object value) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { expr.setValue(ctx.getELContext(), value); return; } } ctx.setPropertyResolved(false); ctx.getELResolver().setValue(ctx, null, this.image, value); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } }
Example #12
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 #13
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 #14
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override public Object getValue(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.getValue(ctx.getELContext()); } } ctx.setPropertyResolved(false); Object result = ctx.getELResolver().getValue(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #15
Source File: AstIdentifier.java From tomcatsrc with Apache License 2.0 | 6 votes |
@Override public void setValue(EvaluationContext ctx, Object value) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { expr.setValue(ctx.getELContext(), value); return; } } ctx.setPropertyResolved(false); ctx.getELResolver().setValue(ctx, null, this.image, value); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } }
Example #16
Source File: AstIdentifier.java From tomcatsrc with Apache License 2.0 | 6 votes |
@Override public boolean isReadOnly(EvaluationContext ctx) throws ELException { VariableMapper varMapper = ctx.getVariableMapper(); if (varMapper != null) { ValueExpression expr = varMapper.resolveVariable(this.image); if (expr != null) { return expr.isReadOnly(ctx.getELContext()); } } ctx.setPropertyResolved(false); boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image); if (!ctx.isPropertyResolved()) { throw new PropertyNotFoundException(MessageFactory.get( "error.resolver.unhandled.null", this.image)); } return result; }
Example #17
Source File: ElMetricName.java From metrics-cdi with Apache License 2.0 | 6 votes |
private ELContext createELContext(final ELResolver resolver, final FunctionMapper functionMapper, final VariableMapper variableMapper) { return new ELContext() { @Override public ELResolver getELResolver() { return resolver; } @Override public FunctionMapper getFunctionMapper() { return functionMapper; } @Override public VariableMapper getVariableMapper() { return variableMapper; } }; }
Example #18
Source File: CdiResolver.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
public CdiResolver() { context = new javax.el.ELContext() { @Override public VariableMapper getVariableMapper() { return null; } @Override public FunctionMapper getFunctionMapper() { return null; } @Override public javax.el.ELResolver getELResolver() { return getWrappedResolver(); } }; }
Example #19
Source File: ValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.expr = in.readUTF(); String type = in.readUTF(); if (!"".equals(type)) { this.expectedType = ReflectionUtil.forName(type); } this.fnMapper = (FunctionMapper) in.readObject(); this.varMapper = (VariableMapper) in.readObject(); }
Example #20
Source File: MethodExpressionImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * @param expr * @param node * @param fnMapper * @param expectedType * @param paramTypes */ public MethodExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class<?> expectedType, Class<?>[] paramTypes) { super(); this.expr = expr; this.node = node; this.fnMapper = fnMapper; this.varMapper = varMapper; this.expectedType = expectedType; this.paramTypes = paramTypes; }
Example #21
Source File: AstIdentifier.java From tomcatsrc with Apache License 2.0 | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }
Example #22
Source File: AstIdentifier.java From Tomcat8-Source-Read with MIT License | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }
Example #23
Source File: MethodExpressionImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.expr = in.readUTF(); String type = in.readUTF(); if (!"".equals(type)) { this.expectedType = ReflectionUtil.forName(type); } this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in .readObject())); this.fnMapper = (FunctionMapper) in.readObject(); this.varMapper = (VariableMapper) in.readObject(); }
Example #24
Source File: ValueExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * */ public ValueExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class<?> expectedType) { this.expr = expr; this.node = node; this.fnMapper = fnMapper; this.varMapper = varMapper; this.expectedType = expectedType; }
Example #25
Source File: RuleEvaluator.java From proctor with Apache License 2.0 | 5 votes |
@Nonnull ELContext createElContext(@Nonnull final Map<String, Object> values) { final Map<String, ValueExpression> localContext = ProctorUtils.convertToValueExpressionMap(expressionFactory, values); @SuppressWarnings("unchecked") final VariableMapper variableMapper = new MulticontextReadOnlyVariableMapper(testConstants, localContext); return createELContext(variableMapper); }
Example #26
Source File: ExpressionBuilder.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * */ public ExpressionBuilder(String expression, ELContext ctx) throws ELException { this.expression = expression; FunctionMapper ctxFn = ctx.getFunctionMapper(); VariableMapper ctxVar = ctx.getVariableMapper(); if (ctxFn != null) { this.fnMapper = new FunctionMapperFactory(ctxFn); } if (ctxVar != null) { this.varMapper = new VariableMapperFactory(ctxVar); } }
Example #27
Source File: MethodExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.expr = in.readUTF(); String type = in.readUTF(); if (!"".equals(type)) { this.expectedType = ReflectionUtil.forName(type); } this.paramTypes = ReflectionUtil.toTypeArray(((String[]) in .readObject())); this.fnMapper = (FunctionMapper) in.readObject(); this.varMapper = (VariableMapper) in.readObject(); }
Example #28
Source File: ValueExpressionImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.expr = in.readUTF(); String type = in.readUTF(); if (!"".equals(type)) { this.expectedType = ReflectionUtil.forName(type); } this.fnMapper = (FunctionMapper) in.readObject(); this.varMapper = (VariableMapper) in.readObject(); }
Example #29
Source File: MethodExpressionImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * @param expr * @param node * @param fnMapper * @param expectedType * @param paramTypes */ public MethodExpressionImpl(String expr, Node node, FunctionMapper fnMapper, VariableMapper varMapper, Class<?> expectedType, Class<?>[] paramTypes) { super(); this.expr = expr; this.node = node; this.fnMapper = fnMapper; this.varMapper = varMapper; this.expectedType = expectedType; this.paramTypes = paramTypes; }
Example #30
Source File: AstIdentifier.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
private final MethodExpression getMethodExpression(EvaluationContext ctx) throws ELException { Object obj = null; // case A: ValueExpression exists, getValue which must // be a MethodExpression VariableMapper varMapper = ctx.getVariableMapper(); ValueExpression ve = null; if (varMapper != null) { ve = varMapper.resolveVariable(this.image); if (ve != null) { obj = ve.getValue(ctx); } } // case B: evaluate the identity against the ELResolver, again, must be // a MethodExpression to be able to invoke if (ve == null) { ctx.setPropertyResolved(false); obj = ctx.getELResolver().getValue(ctx, null, this.image); } // finally provide helpful hints if (obj instanceof MethodExpression) { return (MethodExpression) obj; } else if (obj == null) { throw new MethodNotFoundException("Identity '" + this.image + "' was null and was unable to invoke"); } else { throw new ELException( "Identity '" + this.image + "' does not reference a MethodExpression instance, returned type: " + obj.getClass().getName()); } }