diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java | 58 |
1 files changed, 15 insertions, 43 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java index cc6cb35e28..5c1cbcdf10 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDONotificationBuilder.java @@ -286,52 +286,24 @@ public class CDONotificationBuilder extends CDOFeatureDeltaVisitorImpl Object newValue, int position) { Class<?> instanceClass = feature.getEType().getInstanceClass(); - if (instanceClass == Integer.TYPE) + if (instanceClass.isPrimitive()) { - int old = oldValue == null ? 0 : ((Integer)oldValue).intValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Integer)newValue).intValue()); - } - - if (instanceClass == Boolean.TYPE) - { - boolean old = oldValue == null ? false : ((Boolean)oldValue).booleanValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Boolean)newValue).booleanValue()); - } - - if (instanceClass == Long.TYPE) - { - long old = oldValue == null ? 0 : ((Long)oldValue).longValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Long)newValue).longValue()); - } - - if (instanceClass == Float.TYPE) - { - float old = oldValue == null ? 0 : ((Float)oldValue).floatValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Float)newValue).floatValue()); - } - - if (instanceClass == Double.TYPE) - { - double old = oldValue == null ? 0 : ((Double)oldValue).doubleValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Double)newValue).doubleValue()); - } - - if (instanceClass == Short.TYPE) - { - short old = oldValue == null ? 0 : ((Short)oldValue).shortValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Short)newValue).shortValue()); - } + Object defaultValue = null; + if (oldValue == null) + { + defaultValue = feature.getDefaultValue(); + oldValue = defaultValue; + } - if (instanceClass == Byte.TYPE) - { - byte old = oldValue == null ? 0 : ((Byte)oldValue).byteValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Byte)newValue).byteValue()); - } + if (newValue == null) + { + if (defaultValue == null) + { + defaultValue = feature.getDefaultValue(); + } - if (instanceClass == Character.TYPE) - { - char old = oldValue == null ? 0 : ((Character)oldValue).charValue(); - return new CDODeltaNotificationImpl(object, eventType, feature, old, ((Character)newValue).charValue()); + newValue = defaultValue; + } } return new CDODeltaNotificationImpl(object, eventType, feature, oldValue, newValue, position); |