private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ex) { ex.setPosition(operand.getStartPosition()); throw ex; } }
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ee) { ee.setPosition(operand.getStartPosition()); throw ee; } }
@Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { try { Boolean value = this.children[0].getValue(state, Boolean.class); if (value == null) { throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean"); } return BooleanTypedValue.forValue(!value); } catch (SpelEvaluationException ex) { ex.setPosition(getChild(0).getStartPosition()); throw ex; } }
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ex) { ex.setPosition(operand.getStartPosition()); throw ex; } }
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ee) { ee.setPosition(operand.getStartPosition()); throw ee; } }
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == TypedValue.NULL) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } if (!(value.getValue() instanceof Method)) { // Possibly a static Java method registered as a function throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
/** * Returns a boolean based on whether a value is in the range expressed. The first * operand is any value whilst the second is a list of two values - those two values * being the bounds allowed for the first operand (inclusive). * @param state the expression state * @return true if the left operand is in the range specified, false otherwise * @throws EvaluationException if there is a problem evaluating the expression */ @Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { Object left = getLeftOperand().getValueInternal(state).getValue(); Object right = getRightOperand().getValueInternal(state).getValue(); if (!(right instanceof List) || ((List<?>) right).size() != 2) { throw new SpelEvaluationException(getRightOperand().getStartPosition(), SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST); } List<?> list = (List<?>) right; Object low = list.get(0); Object high = list.get(1); TypeComparator comp = state.getTypeComparator(); try { return BooleanTypedValue.forValue(comp.compare(left, low) >= 0 && comp.compare(left, high) <= 0); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
@Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { try { Boolean value = this.children[0].getValue(state, Boolean.class); if (value == null) { throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean"); } return BooleanTypedValue.forValue(!value); } catch (SpelEvaluationException ex) { ex.setPosition(getChild(0).getStartPosition()); throw ex; } }
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == TypedValue.NULL) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } if (!(value.getValue() instanceof Method)) { // Possibly a static Java method registered as a function throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
ex.setPosition(nextNode.getStartPosition()); throw ex;
/** * Returns a boolean based on whether a value is in the range expressed. The first * operand is any value whilst the second is a list of two values - those two values * being the bounds allowed for the first operand (inclusive). * @param state the expression state * @return true if the left operand is in the range specified, false otherwise * @throws EvaluationException if there is a problem evaluating the expression */ @Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { Object left = getLeftOperand().getValueInternal(state).getValue(); Object right = getRightOperand().getValueInternal(state).getValue(); if (!(right instanceof List) || ((List<?>) right).size() != 2) { throw new SpelEvaluationException(getRightOperand().getStartPosition(), SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST); } List<?> list = (List<?>) right; Object low = list.get(0); Object high = list.get(1); TypeComparator comp = state.getTypeComparator(); try { return BooleanTypedValue.forValue(comp.compare(left, low) >= 0 && comp.compare(left, high) <= 0); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
ex.setPosition(nextNode.getStartPosition()); throw ex;
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ee) { ee.setPosition(operand.getStartPosition()); throw ee; } }
private boolean getBooleanValue(ExpressionState state, SpelNodeImpl operand) { try { Boolean value = operand.getValue(state, Boolean.class); assertValueNotNull(value); return value; } catch (SpelEvaluationException ex) { ex.setPosition(operand.getStartPosition()); throw ex; } }
@Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { try { Boolean value = this.children[0].getValue(state, Boolean.class); if (value == null) { throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean"); } return BooleanTypedValue.forValue(!value); } catch (SpelEvaluationException ex) { ex.setPosition(getChild(0).getStartPosition()); throw ex; } }
@Override public TypedValue getValueInternal(ExpressionState state) throws EvaluationException { TypedValue value = state.lookupVariable(this.name); if (value == TypedValue.NULL) { throw new SpelEvaluationException(getStartPosition(), SpelMessage.FUNCTION_NOT_DEFINED, this.name); } if (!(value.getValue() instanceof Method)) { // Possibly a static Java method registered as a function throw new SpelEvaluationException( SpelMessage.FUNCTION_REFERENCE_CANNOT_BE_INVOKED, this.name, value.getClass()); } try { return executeFunctionJLRMethod(state, (Method) value.getValue()); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
/** * Returns a boolean based on whether a value is in the range expressed. The first * operand is any value whilst the second is a list of two values - those two values * being the bounds allowed for the first operand (inclusive). * @param state the expression state * @return true if the left operand is in the range specified, false otherwise * @throws EvaluationException if there is a problem evaluating the expression */ @Override public BooleanTypedValue getValueInternal(ExpressionState state) throws EvaluationException { Object left = getLeftOperand().getValueInternal(state).getValue(); Object right = getRightOperand().getValueInternal(state).getValue(); if (!(right instanceof List) || ((List<?>) right).size() != 2) { throw new SpelEvaluationException(getRightOperand().getStartPosition(), SpelMessage.BETWEEN_RIGHT_OPERAND_MUST_BE_TWO_ELEMENT_LIST); } List<?> list = (List<?>) right; Object low = list.get(0); Object high = list.get(1); TypeComparator comp = state.getTypeComparator(); try { return BooleanTypedValue.forValue(comp.compare(left, low) >= 0 && comp.compare(left, high) <= 0); } catch (SpelEvaluationException ex) { ex.setPosition(getStartPosition()); throw ex; } }
ex.setPosition(nextNode.getStartPosition()); throw ex;