context.setPropertyResolved(base, property); if (isReadOnly) { throw new PropertyNotWritableException(); throw new PropertyNotFoundException();
/** * <p>Set the value of a scoped object for the specified name.</p> * * @param context <code>ELContext</code> for evaluating this value * @param base Base object against which this evaluation occurs * (must be null because we are evaluating a top level variable) * @param property Property name to be accessed * @param value New value to be set */ public void setValue(ELContext context, Object base, Object property, Object value) { if (base != null) { return; } if (property == null) { throw new PropertyNotFoundException("No property specified"); } FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class); ResourceBundle bundle = fcontext.getApplication().getResourceBundle(fcontext, property.toString()); if (bundle != null) { context.setPropertyResolved(true); throw new PropertyNotWritableException(property.toString()); } }
public boolean isReadOnly(ELContext context, Object base, Object property) { if (property == null) { return true; } try { context.setPropertyResolved(true); if (base == null) { return false; // what can I do? } else { if (base instanceof List || base.getClass().isArray()) { return this.getPropertyResolver().isReadOnly(base, Integer.parseInt(property.toString())); } else { return this.getPropertyResolver().isReadOnly(base, property); } } } catch (PropertyNotFoundException e) { throw new javax.el.PropertyNotFoundException(e.getMessage(), e .getCause()); } catch (EvaluationException e) { throw new ELException(e.getMessage(), e.getCause()); } }
@Override public Object eval(Bindings bindings, ELContext context) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { return expression.getValue(context); } context.setPropertyResolved(false); Object result = context.getELResolver().getValue(context, null, name); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } return result; }
public Object getValue(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.getValue(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException { if (!lvalue) { throw new ELException(LocalMessages.get("error.value.set.rvalue", getStructuralId(bindings))); } Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", "null", base)); } context.setPropertyResolved(false); Class<?> type = context.getELResolver().getType(context, base, property); if (context.isPropertyResolved()) { if (type != null && (value != null || type.isPrimitive())) { value = bindings.convert(value, type); } context.setPropertyResolved(false); } context.getELResolver().setValue(context, base, property, value); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } }
public Class<?> getType(Bindings bindings, ELContext context) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { return expression.getType(context); } context.setPropertyResolved(false); Class<?> result = context.getELResolver().getType(context, null, name); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } return result; }
public boolean isReadOnly(Bindings bindings, ELContext context) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { return expression.isReadOnly(context); } context.setPropertyResolved(false); boolean result = context.getELResolver().isReadOnly(context, null, name); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } return result; }
@Override public Object getValue(FacesContext context) throws ELException { try { return expression.getValue(context.getELContext()); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }
public Class getType(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.getType(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
public boolean isReadOnly(FacesContext context) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { return this.delegate.isReadOnly(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
@Override public Class<?> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base instanceof List<?>) { context.setPropertyResolved(base, property); List<?> list = (List<?>) base; int idx = coerce(property); if (idx < 0 || idx >= list.size()) { throw new PropertyNotFoundException( new ArrayIndexOutOfBoundsException(idx).getMessage()); } return Object.class; } return null; }
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()) { return result; } else { throw new PropertyNotFoundException("Could not resolve property '" + this.image + "'"); } }
@Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base instanceof List<?>) { context.setPropertyResolved(base, property); @SuppressWarnings("unchecked") // Must be OK to cast to Object List<Object> list = (List<Object>) base; if (this.readOnly) { throw new PropertyNotWritableException(Util.message(context, "resolverNotWriteable", base.getClass().getName())); } int idx = coerce(property); try { list.set(idx, value); } catch (UnsupportedOperationException e) { throw new PropertyNotWritableException(e); } catch (IndexOutOfBoundsException e) { throw new PropertyNotFoundException(e); } } }
@Override public void setValue(FacesContext context, Object value) throws ELException { try { expression.setValue(context.getELContext(), value); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }
context.setPropertyResolved(true); int index = toInteger (property); if (index < 0 || index >= Array.getLength(base)) { throw new PropertyNotFoundException();
public void setValue(FacesContext context, Object value) throws EvaluationException, PropertyNotFoundException { ELContext ctx = context.getELContext(); try { this.delegate.setValue(ctx, value); } catch (PropertyNotWritableException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e.getMessage(), e.getCause()); } catch (ELException e) { throw new EvaluationException(e.getMessage(), e.getCause()); } }
@Override public Class<?> getType(FacesContext context) throws ELException { try { return expression.getType(context.getELContext()); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }
@Override public boolean isReadOnly(FacesContext context) throws ELException { try { return expression.isReadOnly(context.getELContext()); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(e); } catch (ELException e) { throw new ELException(e); } }
context.setPropertyResolved(true); List list = (List) base; int index = toInteger(property); if (index < 0 || index >= list.size()) { throw new PropertyNotFoundException();