public void setPropertyValue(Object bean, Object value, FieldMap fieldMap) { if (value == null && getPropertyType().isPrimitive()) { return; // do nothing } // Check if dest value is already set and is equal to src value. If true, no need to rewrite the dest value if (getPropertyValue(bean) == value) { return; } try { if (indexed) { Object existingValue = field.get(bean); Object collection = MappingUtils.prepareIndexedCollection(getPropertyType(), existingValue, value, index); field.set(bean, collection); } else { field.set(bean, value); } } catch (IllegalAccessException e) { MappingUtils.throwMappingException(e); } }
public void setPropertyValue(Object bean, Object value, FieldMap fieldMap) { if (value == null && getPropertyType().isPrimitive()) { return; // do nothing } // Check if dest value is already set and is equal to src value. If // true, no need to rewrite the dest value if (getPropertyValue(bean) == value) { return; } try { if (indexed) { Object existingValue = field.get(bean); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils.throwMappingException("Destinaiton field path should not contain filter expressions"); } Object collection = MappingUtils.prepareIndexedCollection(getPropertyType(), existingValue, value, MappingUtils.getCollectionIndex(index)); field.set(bean, collection); } else { field.set(bean, value); } } catch (IllegalAccessException e) { MappingUtils.throwMappingException(e); } }
public void setPropertyValue(Object bean, Object value, FieldMap fieldMap) { if (value == null && getPropertyType().isPrimitive()) { return; // do nothing } // Check if dest value is already set and is equal to src value. If // true, no need to rewrite the dest value if (getPropertyValue(bean) == value) { return; } try { if (indexed) { Object existingValue = field.get(bean); if (!MappingUtils.isSimpleCollectionIndex(index)) { MappingUtils .throwMappingException("Destinaiton field path should not contain filter expressions"); } Object collection = MappingUtils.prepareIndexedCollection(getPropertyType(), existingValue, value, MappingUtils.getCollectionIndex(index)); field.set(bean, collection); } else { field.set(bean, value); } } catch (IllegalAccessException e) { MappingUtils.throwMappingException(e); } }