/** * Populate diff map comparing the property values between the beans. */ public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) { Object newVal = (newBean == null) ? null : getValue(newBean); Object oldVal = (oldBean == null) ? null : getValue(oldBean); diffVal(prefix, map, newVal, oldVal); }
@Override public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) { Object newEmb = (newBean == null) ? null : getValue(newBean); Object oldEmb = (oldBean == null) ? null : getValue(oldBean); if (newEmb == null && oldEmb == null) { return; } if (embedded) { prefix = (prefix == null) ? name : prefix + "." + name; BeanDescriptor<T> targetDescriptor = getTargetDescriptor(); targetDescriptor.diff(prefix, map, (EntityBean) newEmb, (EntityBean) oldEmb); } else { // we are only interested in the Id value newBean = (EntityBean) newEmb; oldBean = (EntityBean) oldEmb; BeanDescriptor<T> targetDescriptor = getTargetDescriptor(); BeanProperty idProperty = targetDescriptor.getIdProperty(); Object newId = (newBean == null) ? null : idProperty.getValue(newBean); Object oldId = (oldBean == null) ? null : idProperty.getValue(oldBean); if (newId != null || oldId != null) { prefix = (prefix == null) ? name : prefix + "." + name; idProperty.diffVal(prefix, map, newId, oldId); } } }
/** * Populate diff map comparing the property values between the beans. */ public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) { Object newVal = (newBean == null) ? null : getValue(newBean); Object oldVal = (oldBean == null) ? null : getValue(oldBean); diffVal(prefix, map, newVal, oldVal); }
@Override public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) { Object newEmb = (newBean == null) ? null : getValue(newBean); Object oldEmb = (oldBean == null) ? null : getValue(oldBean); if (newEmb == null && oldEmb == null) { return; } if (embedded) { prefix = (prefix == null) ? name : prefix + "." + name; BeanDescriptor<T> targetDescriptor = getTargetDescriptor(); targetDescriptor.diff(prefix, map, (EntityBean) newEmb, (EntityBean) oldEmb); } else { // we are only interested in the Id value newBean = (EntityBean) newEmb; oldBean = (EntityBean) oldEmb; BeanDescriptor<T> targetDescriptor = getTargetDescriptor(); BeanProperty idProperty = targetDescriptor.getIdProperty(); Object newId = (newBean == null) ? null : idProperty.getValue(newBean); Object oldId = (oldBean == null) ? null : idProperty.getValue(oldBean); if (newId != null || oldId != null) { prefix = (prefix == null) ? name : prefix + "." + name; idProperty.diffVal(prefix, map, newId, oldId); } } }