protected void validateUpdateItemTypes(UpdateItem expression, Object type) {
if (expression.hasNewValue()) {
Expression newValue = expression.getNewValue();
ITypeHelper typeHelper = getTypeHelper();
boolean nullValue = isNullValue(newValue);
// A NULL value is ignored, except if the type is a primitive, null cannot be
// assigned to a mapping of primitive type
if (nullValue) {
if (typeHelper.isPrimitiveType(type)) {
addProblem(expression, UpdateItem_NullNotAssignableToPrimitive);
}
return;
}
Object newValueType = getType(newValue);
// Do a quick check for known JDK types:
// 1) Date/Time/Timestamp
// 2) Any classes related to a number, eg long/Long etc
if (!helper.isTypeResolvable(newValueType) ||
typeHelper.isDateType(type) && typeHelper.isDateType(newValueType) ||
(typeHelper.isNumericType(type) || typeHelper.isPrimitiveType(type)) &&
(typeHelper.isNumericType(newValueType) || typeHelper.isPrimitiveType(newValueType))) {
return;
}
// The new value's type can't be assigned to the item's type