Improved: function parseBigDecimalForEntity is in wrong location

(OFBIZ-10689)

Actually this is a firts step that simply renames 
  ObjectType::simpleTypeConvert to
  ObjectType::simpleTypeOrObjectConvert
and improves the simpleTypeOrObjectConvert Javadoc

Thanks: Pierre Smits for report, Deepak Dixit for discussion

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1850027 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2018-12-31 09:23:36 +00:00
parent 9306ba09b6
commit b7f211729f
30 changed files with 68 additions and 61 deletions
@@ -485,7 +485,7 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
// make sure the type matches the field Java type
if (value instanceof TimeDuration) {
try {
value = ObjectType.simpleTypeConvert(value, type.getJavaType(), null, null);
value = ObjectType.simpleTypeOrObjectConvert(value, type.getJavaType(), null, null);
} catch (GeneralException e) {
Debug.logError(e, module);
}
@@ -1376,7 +1376,7 @@ public class ModelEntity implements Comparable<ModelEntity>, Serializable {
throw new IllegalArgumentException(errMsg);
}
try {
return ObjectType.simpleTypeConvert(value, fieldJavaType, null, null, false);
return ObjectType.simpleTypeOrObjectConvert(value, fieldJavaType, null, null, false);
} catch (GeneralException e) {
String errMsg = "Could not convert field value for the field: [" + modelField.getName() + "] on the [" + this.getEntityName() + "] entity to the [" + fieldJavaType + "] type for the value [" + value + "]: " + e.toString();
Debug.logError(e, errMsg, module);
@@ -1404,7 +1404,7 @@ public class ModelEntity implements Comparable<ModelEntity>, Serializable {
}
String fieldJavaType = modelFieldTypeReader.getModelFieldType(modelField.getType()).getJavaType();
try {
return ObjectType.simpleTypeConvert(value, fieldJavaType, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
return ObjectType.simpleTypeOrObjectConvert(value, fieldJavaType, null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
} catch (GeneralException e) {
String errMsg = "Could not convert field value for the field: [" + modelField.getName() + "] on the [" + this.getEntityName() + "] entity to the [" + fieldJavaType + "] type for the value [" + value + "]: " + e.toString();
Debug.logError(e, errMsg, module);
@@ -63,7 +63,7 @@ public class Converters implements ConverterLoader {
Object fieldValue = entry.getValue();
ModelField field = value.getModelEntity().getField(fieldName);
ModelFieldType type = delegator.getEntityFieldType(value.getModelEntity(), field.getType());
value.set(fieldName, ObjectType.simpleTypeConvert(fieldValue, type.getJavaType(), null, null));
value.set(fieldName, ObjectType.simpleTypeOrObjectConvert(fieldValue, type.getJavaType(), null, null));
}
return value;
} catch (ConversionException e) {