@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)); } }
public static EvaluationContext buildEvaluationContext( Map<String, Method> functionMethodMap, Map<String, Object> attributeMap) { VariableMapper vMapper = buildVariableMapper(attributeMap); FunctionMapper fMapper = buildFunctionMapper(functionMethodMap); EsfingeELContext context = new EsfingeELContext(fMapper, vMapper, new ArrayELResolver(), new ListELResolver(), new MapELResolver(), new BeanELResolver()); return new EvaluationContext(context, fMapper, vMapper); }
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; } }; }
@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; }
@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; }
@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; }
@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); }
/** * Saves the var and varStatus information from both the variable mapper as well as the * page context so that the values may be restored to their values after the for each tag * has finished iterating. * @param vm the current variable mapper */ private void _backupContextVariables(VariableMapper vm) { if (_var != null) { // Store off the current values used by the var name so that it may be restored after // tag processing _previousVarExpression = vm.resolveVariable(_var); _previousPageContextVarValue = pageContext.getAttribute(_var); } if (_varStatus != null) { // Store off the current values for the varStatus name to be able to restore it after // processing this tag _previousVarStatusExpression = vm.resolveVariable(_varStatus); _previousPageContextVarStatusValue = pageContext.getAttribute(_varStatus); } }
/** * */ 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; }
/** * */ 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); } }
@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; }
@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; }
@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; }
@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)); } }
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(); } }; }
/** * */ 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; }
@Override protected int doStartTagInternal() throws Exception { CodeManager codeManager = getCodeManager(); T object = getObject(codeManager, codeName, value, plainLabel); if (StringUtils.isNotEmpty(var)) { VariableMapper vm = pageContext.getELContext().getVariableMapper(); if (vm != null) { vm.setVariable(var, null); } pageContext.setAttribute(var, object, PageContext.PAGE_SCOPE); } if (doesEvalBody(codeManager, codeName, value, plainLabel)) { return EVAL_BODY_INCLUDE; } else { return SKIP_BODY; } }
private ExtendedELContext createELContext(final ELResolver resolver, final FunctionMapper functionMapper, final VariableMapper variableMapper, final ConstantResolver constantResolver) { return new ExtendedELContext() { @Override public ELResolver getELResolver() { return resolver; } @Override public FunctionMapper getFunctionMapper() { return functionMapper; } @Override public VariableMapper getVariableMapper() { return variableMapper; } @Override public ConstantResolver getConstantResolver() { return constantResolver; } }; }