} else if (returnType.isAssignableFrom(Integer.class)) {
return returnType.cast(valueBigDecimal.intValueExact());
} else if (returnType.isAssignableFrom(Short.class)) {
return returnType.cast(valueBigDecimal.shortValueExact());
} else if (returnType.isAssignableFrom(Byte.class)) {
return returnType.cast(valueBigDecimal.byteValueExact());
} else {
throw new EdmSimpleTypeException(EdmSimpleTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType));
}
} catch (final ArithmeticException e) {
throw new EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value,