private void setProperty( Object instance, FieldRecord fieldRecord, MotechDataService service, Long deleteValueFieldId) throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException { String fieldName = fieldRecord.getName(); TypeDto type = getType(fieldRecord); String methodName = "set" + StringUtils.capitalize(fieldName); ComboboxHolder holder = type.isCombobox() ? new ComboboxHolder(instance, fieldRecord) : null; String methodParameterType = getMethodParameterType(type, holder); ClassLoader classLoader = instance.getClass().getClassLoader(); Class<?> parameterType; Object parsedValue; if (Byte[].class.getName().equals(methodParameterType) || byte[].class.getName().equals(methodParameterType)) { parameterType = getCorrectByteArrayType(methodParameterType); parsedValue = parseBlobValue(fieldRecord, service, fieldName, deleteValueFieldId, instance); } else { parameterType = classLoader.loadClass(methodParameterType); parsedValue = parseValue(holder, methodParameterType, fieldRecord, classLoader); } validateNonEditableField(fieldRecord, instance, parsedValue); Method method = MethodUtils.getAccessibleMethod(instance.getClass(), methodName, parameterType); if (method == null && TypeHelper.hasPrimitive(parameterType)) { method = MethodUtils.getAccessibleMethod( instance.getClass(), methodName, TypeHelper.getPrimitive(parameterType)); // if the setter is for a primitive, but we have a null, we leave the default if (method != null && parsedValue == null) { return; } } invokeMethod(method, instance, parsedValue, methodName, fieldName); }