public Object getValue(Object context) throws EvaluationException { throw new EvaluationException(Object.class, "foo", "Model expression failed to evaluate"); }
public void evaluateToSet(Object target, Object value, EvaluationContext context) throws EvaluationException { Object result = evaluate(target, context); if (result == null) { throw new EvaluationException(new SetValueAttempt(this, target, value, null), new IllegalArgumentException( "The collection expression evaluated to a [null] reference")); } Assert.isInstanceOf(Collection.class, result, "Not a collection: "); if (value != null) { // add the value to the collection ((Collection) result).add(value); } }
public void setValue(Object context, Object value) throws EvaluationException { Object result = getValue(context); if (result == null) { throw new EvaluationException(context.getClass(), collectionExpression.getExpressionString(), "Unable to access collection value for expression '" + collectionExpression.getExpressionString() + "'", new IllegalStateException( "The collection expression evaluated to a [null] reference")); } Assert.isInstanceOf(Collection.class, result, "Not a collection: "); if (value != null) { // add the value to the collection ((Collection) result).add(value); } }
@SuppressWarnings("unchecked") public void setValue(Object context, Object value) throws EvaluationException { Object result = getValue(context); if (result == null) { throw new EvaluationException(context.getClass(), collectionExpression.getExpressionString(), "Unable to access collection value for expression '" + collectionExpression.getExpressionString() + "'", new IllegalStateException( "The collection expression evaluated to a [null] reference")); } Assert.isInstanceOf(Collection.class, result, "Not a collection: "); if (value != null) { // add the value to the collection ((Collection<Object>) result).add(value); } }
@SuppressWarnings("unchecked") public void setValue(Object context, Object value) throws EvaluationException { Object result = getValue(context); if (result == null) { throw new EvaluationException(context.getClass(), collectionExpression.getExpressionString(), "Unable to access collection value for expression '" + collectionExpression.getExpressionString() + "'", new IllegalStateException( "The collection expression evaluated to a [null] reference")); } Assert.isInstanceOf(Collection.class, result, "Not a collection: "); if (value != null) { // add the value to the collection ((Collection<Object>) result).add(value); } }
public Class<?> getValueType(Object context) { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); return beanWrapper.getPropertyType(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An BeansException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public void evaluateToSet(Object target, Object value, EvaluationContext context) throws EvaluationException { try { Assert.notNull(target, "The target object to evaluate is required"); new BeanWrapperImpl(target).setPropertyValue(expression, value); } catch (BeansException e) { throw new EvaluationException(new SetValueAttempt(this, target, value, context), e); } }
public Class<?> getValueType(Object context) { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); return beanWrapper.getPropertyType(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An BeansException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Object getValue(Object context) throws EvaluationException { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); return beanWrapper.getPropertyValue(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "A BeansException occurred getting the value for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Class getValueType(Object context) { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); return beanWrapper.getPropertyType(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An BeansException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Class getValueType(Object context) { try { // OGNL has no native way to get this information return new BeanWrapperImpl(context).getPropertyType(expressionString); } catch (InvalidPropertyException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An BeansException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Object evaluate(Object target, EvaluationContext context) throws EvaluationException { try { return new BeanWrapperImpl(target).getPropertyValue(expression); } catch (BeansException e) { throw new EvaluationException(new EvaluationAttempt(this, target, context), e); } }
public Object getValue(Object context) throws EvaluationException { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); beanWrapper.setAutoGrowNestedPaths(autoGrowNestedPaths); beanWrapper.setAutoGrowCollectionLimit(autoGrowCollectionLimit); return beanWrapper.getPropertyValue(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "A BeansException occurred getting the value for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Class<?> getValueType(Object context) { ELContext ctx = elContextFactory.getELContext(context); try { return valueExpression.getType(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (ELException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An ELException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Object getValue(Object context) throws EvaluationException { try { BeanWrapperImpl beanWrapper = new BeanWrapperImpl(context); beanWrapper.setAutoGrowNestedPaths(autoGrowNestedPaths); beanWrapper.setAutoGrowCollectionLimit(autoGrowCollectionLimit); return beanWrapper.getPropertyValue(expression); } catch (NotReadablePropertyException e) { throw new PropertyNotFoundException(context.getClass(), expression, e); } catch (BeansException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "A BeansException occurred getting the value for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Class<?> getValueType(Object context) { ELContext ctx = elContextFactory.getELContext(context); try { return valueExpression.getType(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (ELException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An ELException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public Class getValueType(Object context) { ELContext ctx = elContextFactory.getELContext(context); try { return valueExpression.getType(ctx); } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (ELException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An ELException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }
public void evaluateToSet(Object target, Object value, EvaluationContext context) { Assert.notNull(target, "The target object to evaluate is required"); Map contextAttributes = (context != null ? context.getAttributes() : Collections.EMPTY_MAP); try { Ognl.setValue(expression, contextAttributes, target, value); } catch (OgnlException e) { throw new EvaluationException(new SetValueAttempt(this, target, value, context), e); } }
public void setValue(Object context, Object value) throws EvaluationException { ELContext ctx = elContextFactory.getELContext(context); try { valueExpression.setValue(ctx, value); if (!ctx.isPropertyResolved()) { throw new EvaluationException(context.getClass(), getExpressionString(), "The expression '" + getExpressionString() + "' did not resolve... is the base variable ''" + getBaseVariable() + "' spelled correctly?"); } } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (ELException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An ELException occurred setting the value of expression '" + getExpressionString() + "' on context [" + context.getClass() + "] to [" + value + "]", e); } }
public Object getValue(Object context) throws EvaluationException { ELContext ctx = elContextFactory.getELContext(context); try { Object result = valueExpression.getValue(ctx); if (result == null && !ctx.isPropertyResolved()) { if (getExpressionString().equals("null")) { // special case for handling reserved null keyword return null; } else { throw new EvaluationException(context.getClass(), getExpressionString(), "The expression '" + getExpressionString() + "' did not resolve... is the base variable '" + getBaseVariable() + "' spelled correctly?"); } } return result; } catch (javax.el.PropertyNotFoundException e) { throw new PropertyNotFoundException(context.getClass(), getExpressionString(), e); } catch (ELException e) { throw new EvaluationException(context.getClass(), getExpressionString(), "An ELException occurred getting the value for expression '" + getExpressionString() + "' on context [" + context.getClass() + "]", e); } }