Java Code Examples for org.springframework.expression.spel.SpelMessage#TYPE_CONVERSION_ERROR

The following examples show how to use org.springframework.expression.spel.SpelMessage#TYPE_CONVERSION_ERROR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Ternary.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Evaluate the condition and if true evaluate the first alternative, otherwise
 * evaluate the second alternative.
 * @param state the expression state
 * @throws EvaluationException if the condition does not evaluate correctly to
 * a boolean or there is a problem executing the chosen alternative
 */
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
	Boolean value = this.children[0].getValue(state, Boolean.class);
	if (value == null) {
		throw new SpelEvaluationException(getChild(0).getStartPosition(),
				SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
	TypedValue result = this.children[value ? 1 : 2].getValueInternal(state);
	computeExitTypeDescriptor();
	return result;
}
 
Example 2
Source File: StandardTypeConverter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
	try {
		return this.conversionService.convert(value, sourceType, targetType);
	}
	catch (ConversionException ex) {
		throw new SpelEvaluationException(
				ex, SpelMessage.TYPE_CONVERSION_ERROR, sourceType.toString(), targetType.toString());
	}
}
 
Example 3
Source File: OperatorNot.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
	}
}
 
Example 4
Source File: Ternary.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Evaluate the condition and if true evaluate the first alternative, otherwise
 * evaluate the second alternative.
 * @param state the expression state
 * @throws EvaluationException if the condition does not evaluate correctly to
 * a boolean or there is a problem executing the chosen alternative
 */
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
	Boolean value = this.children[0].getValue(state, Boolean.class);
	if (value == null) {
		throw new SpelEvaluationException(getChild(0).getStartPosition(),
				SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
	TypedValue result = this.children[value ? 1 : 2].getValueInternal(state);
	computeExitTypeDescriptor();
	return result;
}
 
Example 5
Source File: StandardTypeConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
	try {
		return this.conversionService.convert(value, sourceType, targetType);
	}
	catch (ConversionException ex) {
		throw new SpelEvaluationException(ex, SpelMessage.TYPE_CONVERSION_ERROR,
				(sourceType != null ? sourceType.toString() : (value != null ? value.getClass().getName() : "null")),
				targetType.toString());
	}
}
 
Example 6
Source File: OperatorNot.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
	}
}
 
Example 7
Source File: Ternary.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Evaluate the condition and if true evaluate the first alternative, otherwise
 * evaluate the second alternative.
 * @param state the expression state
 * @throws EvaluationException if the condition does not evaluate correctly to
 * a boolean or there is a problem executing the chosen alternative
 */
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
	Boolean value = this.children[0].getValue(state, Boolean.class);
	if (value == null) {
		throw new SpelEvaluationException(getChild(0).getStartPosition(),
				SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
	TypedValue result = this.children[value ? 1 : 2].getValueInternal(state);
	computeExitTypeDescriptor();
	return result;
}
 
Example 8
Source File: StandardTypeConverter.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
@Nullable
public Object convertValue(@Nullable Object value, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
	try {
		return this.conversionService.convert(value, sourceType, targetType);
	}
	catch (ConversionException ex) {
		throw new SpelEvaluationException(ex, SpelMessage.TYPE_CONVERSION_ERROR,
				(sourceType != null ? sourceType.toString() : (value != null ? value.getClass().getName() : "null")),
				targetType.toString());
	}
}
 
Example 9
Source File: OperatorNot.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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;
	}
}
 
Example 10
Source File: Ternary.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Evaluate the condition and if true evaluate the first alternative, otherwise
 * evaluate the second alternative.
 * @param state the expression state
 * @throws EvaluationException if the condition does not evaluate correctly to
 * a boolean or there is a problem executing the chosen alternative
 */
@Override
public TypedValue getValueInternal(ExpressionState state) throws EvaluationException {
	Boolean value = this.children[0].getValue(state, Boolean.class);
	if (value == null) {
		throw new SpelEvaluationException(getChild(0).getStartPosition(),
				SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
	TypedValue result = this.children[value ? 1 : 2].getValueInternal(state);
	computeExitTypeDescriptor();
	return result;
}
 
Example 11
Source File: StandardTypeConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public Object convertValue(@Nullable Object value, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
	try {
		return this.conversionService.convert(value, sourceType, targetType);
	}
	catch (ConversionException ex) {
		throw new SpelEvaluationException(ex, SpelMessage.TYPE_CONVERSION_ERROR,
				(sourceType != null ? sourceType.toString() : (value != null ? value.getClass().getName() : "null")),
				targetType.toString());
	}
}
 
Example 12
Source File: OperatorNot.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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;
	}
}
 
Example 13
Source File: OpOr.java    From java-technology-stack with MIT License 4 votes vote down vote up
private void assertValueNotNull(@Nullable Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 14
Source File: OpAnd.java    From java-technology-stack with MIT License 4 votes vote down vote up
private void assertValueNotNull(@Nullable Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 15
Source File: OpAnd.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void assertValueNotNull(Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 16
Source File: OpOr.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private void assertValueNotNull(Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 17
Source File: OpAnd.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private void assertValueNotNull(Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 18
Source File: OpOr.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private void assertValueNotNull(Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 19
Source File: OpOr.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private void assertValueNotNull(@Nullable Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}
 
Example 20
Source File: OpAnd.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private void assertValueNotNull(@Nullable Boolean value) {
	if (value == null) {
		throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, "null", "boolean");
	}
}