public SpelParseException(int position, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
/** * Returns the type of the expression target based on the given root. * * @param root must not be {@literal null}. * @return */ public Class<?> getType(Object root) { Assert.notNull(root, "Root object must not be null!"); try { return expression.getValueType(CONTEXT, root); } catch (SpelEvaluationException o_O) { if (!SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS.equals(o_O.getMessageCode())) { throw o_O; } Object collectionOrArray = getParent().getValue(root); if (Collection.class.isInstance(collectionOrArray)) { return CollectionUtils.findCommonElementType(Collection.class.cast(collectionOrArray)); } } throw new IllegalArgumentException(String.format("Cannot obtain type for path %s on %s!", path, root)); }
/** * Returns the type of the expression target based on the given root. * * @param root must not be {@literal null}. * @return */ public Class<?> getType(Object root) { Assert.notNull(root, "Root object must not be null!"); try { return expression.getValueType(CONTEXT, root); } catch (SpelEvaluationException o_O) { if (!SpelMessage.COLLECTION_INDEX_OUT_OF_BOUNDS.equals(o_O.getMessageCode())) { throw o_O; } Object collectionOrArray = getParent().getValue(root); if (Collection.class.isInstance(collectionOrArray)) { return CollectionUtils.findCommonElementType(Collection.class.cast(collectionOrArray)); } } throw new IllegalArgumentException(String.format("Cannot obtain type for path %s on %s!", path, root)); }
public SpelEvaluationException(SpelMessage message, Object... inserts) { super(message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public Object getValue(Object rootObject) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } return expression.getValue(context, expectedType); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } if (e.getMessageCode().equals(SpelMessage.TYPE_CONVERSION_ERROR)) { throw new ValueCoercionException(rootObject.getClass(), getExpressionString(), null, expectedType, e); } throw new EvaluationException(rootObject.getClass(), expression.getExpressionString(), "An ELException occurred getting the value for expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "]", e); } }
public SpelEvaluationException(int position, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public Object getValue(Object rootObject) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } return expression.getValue(context, expectedType); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } if (e.getMessageCode().equals(SpelMessage.TYPE_CONVERSION_ERROR)) { throw new ValueCoercionException(rootObject.getClass(), getExpressionString(), null, expectedType, e); } throw new EvaluationException(rootObject.getClass(), expression.getExpressionString(), "An ELException occurred getting the value for expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "]", e); } }
public SpelEvaluationException(Throwable cause, SpelMessage message, Object... inserts) { super(message.formatMessage(inserts), cause); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public void setValue(Object rootObject, Object value) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } expression.setValue(context, value); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } if (e.getMessageCode().equals(SpelMessage.EXCEPTION_DURING_PROPERTY_WRITE)) { throw new ValueCoercionException(rootObject.getClass(), getExpressionString(), value, expectedType, e); } throw new EvaluationException(rootObject.getClass(), getExpressionString(), "An ELException occurred setting the value of expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "] to [" + value + "]", e); } }
public SpelParseException(int position, Throwable cause, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts), cause); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public void setValue(Object rootObject, Object value) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } expression.setValue(context, value); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } if (e.getMessageCode().equals(SpelMessage.EXCEPTION_DURING_PROPERTY_WRITE)) { throw new ValueCoercionException(rootObject.getClass(), getExpressionString(), value, expectedType, e); } throw new EvaluationException(rootObject.getClass(), getExpressionString(), "An ELException occurred setting the value of expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "] to [" + value + "]", e); } }
public SpelEvaluationException(int position, Throwable cause, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts), cause); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public Class<?> getValueType(Object rootObject) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } return expression.getValueType(context); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } throw new EvaluationException(rootObject.getClass(), getExpressionString(), "An ELException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "]", e); } }
public SpelParseException(@Nullable String expressionString, int position, SpelMessage message, Object... inserts) { super(expressionString, position, message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
@SuppressWarnings("deprecation") public Class<?> getValueType(Object rootObject) throws EvaluationException { try { EvaluationContext context = contextFactory.createContext(rootObject); if (context instanceof StandardEvaluationContext) { extendEvaluationContext((StandardEvaluationContext) context); } return expression.getValueType(context); } catch (SpelEvaluationException e) { if (e.getMessageCode().equals(SpelMessage.PROPERTY_OR_FIELD_NOT_READABLE)) { throw new PropertyNotFoundException(rootObject.getClass(), getExpressionString(), e); } throw new EvaluationException(rootObject.getClass(), getExpressionString(), "An ELException occurred getting the value type for expression '" + getExpressionString() + "' on context [" + rootObject.getClass() + "]", e); } }
public SpelEvaluationException(int position, Throwable cause, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts), cause); this.message = message; this.inserts = inserts; }
public SpelParseException(int position, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
public SpelEvaluationException(SpelMessage message, Object... inserts) { super(message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }
public SpelParseException(int position, Throwable cause, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts), cause); this.message = message; this.inserts = inserts; }
public SpelEvaluationException(int position, SpelMessage message, Object... inserts) { super(position, message.formatMessage(inserts)); this.message = message; this.inserts = inserts; }