@Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { throw new PropertyNotFoundException("Could not find property " + property + " in " + base.getClass()); } return null; }
throw new PropertyNotFoundException("List index out of bounds: " + index);
throw new PropertyNotFoundException("Array index out of bounds: " + index);
@Override public ValueReference getValueReference(Bindings bindings, ELContext context) { 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)); } return new ValueReference(base, property); }
@Override public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { 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.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); return new MethodInfo(method.getName(), method.getReturnType(), paramTypes); }
@Override public Object getValue(ELContext context, Object base, Object property) { if (resolve(context, base, property)) { if (!isProperty((String) property)) { throw new PropertyNotFoundException("Cannot find property " + property); } return getProperty((String) property); } return null; }
@Override public boolean isReadOnly(Bindings bindings, ELContext context) throws ELException { if (!lvalue) { return true; } 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); boolean result = context.getELResolver().isReadOnly(context, base, property); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } return result; }
@Override public Class<?> getType(Bindings bindings, ELContext context) { if (!lvalue) { return null; } 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<?> result = context.getELResolver().getType(context, base, property); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } return result; }
@Override public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { 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.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); try { return method.invoke(base, paramValues); } catch (IllegalAccessException e) { throw new ELException(LocalMessages.get("error.property.method.access", name, base.getClass()), e); } catch (IllegalArgumentException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e); } catch (InvocationTargetException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e.getCause()); } }
@Override 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)); } }
@Override 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; }
@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; }
@Override 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; }
protected Object eval(Bindings bindings, ELContext context, boolean answerNullIfBaseIsNull) { Object base = property.getPrefix().eval(bindings, context); if (base == null) { if (answerNullIfBaseIsNull) { return null; } throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", property.getPrefix())); } Object method = property.getProperty(bindings, context); if (method == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(method, String.class); context.setPropertyResolved(false); Object result = context.getELResolver().invoke(context, base, name, null, params.eval(bindings, context)); if (!context.isPropertyResolved()) { throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); } return result; }
@Override public Object eval(Bindings bindings, ELContext context) { Object base = prefix.eval(bindings, context); if (base == null) { return null; } Object property = getProperty(bindings, context); if (property == null && strict) { return null; } context.setPropertyResolved(false); Object result = context.getELResolver().getValue(context, base, property); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } return result; }
@Override public void setValue(Bindings bindings, ELContext context, Object value) { ValueExpression expression = bindings.getVariable(index); if (expression != null) { expression.setValue(context, value); return; } context.setPropertyResolved(false); Class<?> type = context.getELResolver().getType(context, null, name); if (context.isPropertyResolved()) { if (type != null && (value != null || type.isPrimitive())) { value = bindings.convert(value, type); } context.setPropertyResolved(false); } context.getELResolver().setValue(context, null, name, value); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name)); } }