@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; if (applicationContext.containsBean(key)) { context.setPropertyResolved(true); return applicationContext.getBean(key); } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; if (applicationContext.containsBean(key)) { context.setPropertyResolved(true); return applicationContext.getBean(key); } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { if (wrappedMap.containsKey(property)) { context.setPropertyResolved(true); return wrappedMap.get(property); } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { if (wrappedMap.containsKey(property)) { context.setPropertyResolved(true); return wrappedMap.get(property); } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; if (applicationContext.containsBean(key)) { context.setPropertyResolved(true); return applicationContext.getBean(key); } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; if (applicationContext.containsBean(key)) { context.setPropertyResolved(true); return applicationContext.getBean(key); } } return null; }
@Override public Class<?> getType(ELContext context, Object base, Object property) { if (base == null || this.getCommonPropertyType(context, base) == null) { return null; } context.setPropertyResolved(true); return Object.class; }
@Override public Object getValue(ELContext context, Object base, Object property) { Object bean = Mocks.get(property); if (bean != null) { context.setPropertyResolved(true); } return bean; }
/** * If the base object is not null and an instanceof java.util.ResourceBundle, return true. * * @return If the propertyResolved property of ELContext was set to true, then true; otherwise * undefined. * @throws NullPointerException * if context is null. */ @Override public boolean isReadOnly(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { context.setPropertyResolved(true); } return true; }
private boolean resolve(ELContext context, Object base, Object property) { context.setPropertyResolved(isResolvable(base) && property instanceof String); return context.isPropertyResolved(); }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null) { String variable = (String) property; // according to javadoc, can only be a String if (variableContainer.hasVariable(variable)) { context.setPropertyResolved(true); // if not set, the next elResolver in the CompositeElResolver will be called return variableContainer.getVariable(variable); } } return null; }
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null) { String variable = (String) property; if (variableContainer.hasVariable(variable)) { context.setPropertyResolved(true); variableContainer.setVariable(variable, value); } } }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null || this.getCommonPropertyType(context, base) == null) { return null; } String propertyName = property.toString(); try { Object value = ReflectUtil.invoke(base, this.readMethodName, new Object[] { propertyName }); context.setPropertyResolved(true); return value; } catch (Exception e) { throw new ELException(e); } }
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (base == null || this.getCommonPropertyType(context, base) == null) { return; } String propertyName = property.toString(); try { ReflectUtil.invoke(base, this.writeMethodName, new Object[] { propertyName, value }); context.setPropertyResolved(true); } catch (Exception e) { throw new ELException(e); } } }
@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; }
@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; }
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 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; }