summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java
diff options
context:
space:
mode:
Diffstat (limited to 'projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java')
-rw-r--r--projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java161
1 files changed, 96 insertions, 65 deletions
diff --git a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java
index 3a39035..8342722 100644
--- a/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java
+++ b/projects/net.wotonomy.persistence/src/main/java/net/wotonomy/control/EOEditingContext.java
@@ -89,23 +89,24 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
private EOObjectStore parentStore;
private WeakReference delegate;
private WeakReference messageHandler;
- private List editorSet;
+ private List<WeakReference<EOEditingContext.Editor>> editorSet;
private double fetchTimestamp;
private boolean lockBeforeModify;
private boolean propagateDeletesAfterEvent;
private boolean stopValidationAfterError;
- private NSMutableArray insertedObjects;
- private NSMutableArray insertedObjectsBuffer;
- private NSArray insertedObjectsProxy;
- private NSMutableArray updatedObjects;
- private NSMutableArray updatedObjectsBuffer;
- private NSArray updatedObjectsProxy;
- private NSMutableArray deletedObjects;
- private NSMutableArray deletedObjectsBuffer;
- private NSArray deletedObjectsProxy;
- private NSMutableArray deletedIDsBuffer;
- private NSMutableArray invalidatedObjectsBuffer;
- private NSMutableArray invalidatedIDsBuffer;
+ private NSMutableArray<Object> insertedObjects;
+ private NSMutableArray<Object> insertedObjectsBuffer;
+ private NSArray<Object> insertedObjectsProxy;
+ private NSMutableArray<Object> updatedObjects;
+ private NSMutableArray<Object> updatedObjectsBuffer;
+ private NSArray<Object> updatedObjectsProxy;
+ private NSMutableArray<Object> deletedObjects;
+ private NSMutableArray<Object> deletedObjectsBuffer;
+ private NSArray<Object> deletedObjectsProxy;
+ // TODO I think this is EOGlobalID but not certain
+ private NSMutableArray<Object> deletedIDsBuffer;
+ private NSMutableArray<Object> invalidatedObjectsBuffer;
+ private NSMutableArray<EOGlobalID> invalidatedIDsBuffer;
private Registrar registrar;
// private UndoManager undoManager;
@@ -143,7 +144,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
parentStore = anObjectStore;
delegate = null;
messageHandler = null;
- editorSet = new LinkedList();
+ editorSet = new LinkedList<>();
fetchTimestamp = 0;
lockBeforeModify = false;
propagateDeletesAfterEvent = true;
@@ -189,10 +190,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Registers the specified object as an editor for this context. The object is
* expected to implement EOEditingContext.Editor.
*/
- public void addEditor(Object anEditor) {
+ public void addEditor(EOEditingContext.Editor anEditor) {
if (anEditor == null)
return;
- editorSet.add(new WeakReference(anEditor));
+ editorSet.add(new WeakReference<>(anEditor));
}
/**
@@ -205,6 +206,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* specified relationship key must produce a result of type Collection for the
* source object or an exception is thrown.
*/
+ @Override
public NSArray arrayFaultWithSourceGlobalID(EOGlobalID aGlobalID, String aRelationshipKey,
EOEditingContext aContext) {
NSArray result = null;
@@ -337,6 +339,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Called by child editing contexts when they no longer need to track the
* specified id. This implementation forwards the call to the parent store.
*/
+ @Override
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext aContext, EOGlobalID aGlobalID) {
parentStore.editingContextDidForgetObjectWithGlobalID(aContext, aGlobalID);
}
@@ -347,9 +350,9 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
public NSArray editors() {
NSMutableArray result = new NSMutableArray();
Object o;
- Iterator i = editorSet.iterator();
+ Iterator<WeakReference<Editor>> i = editorSet.iterator();
while (i.hasNext()) {
- o = ((WeakReference) i.next()).get();
+ o = i.next().get();
if (o != null) {
result.addObject(o);
} else {
@@ -370,6 +373,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* create a copy of the object and register it in the specified context.
* Otherwise it will forward the call to the parent object store.
*/
+ @Override
public /* EOEnterpriseObject */ Object faultForGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
Object result = registrar.objectForGlobalID(aGlobalID);
@@ -402,6 +406,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* specified editing context. This implementation forwards the call to the
* parent store.
*/
+ @Override
public /* EOEnterpriseObject */ Object faultForRawRow(Map aDictionary, String anEntityName,
EOEditingContext aContext) {
return parentStore.faultForRawRow(aDictionary, anEntityName, aContext);
@@ -461,11 +466,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
/**
* Returns an array of ids for an array of objects.
*/
- private NSArray globalIDsForObjects(List anObjectList) {
+ private NSArray globalIDsForObjects(List<Object> anObjectList) {
NSMutableArray result = new NSMutableArray();
- Iterator it = anObjectList.iterator();
- while (it.hasNext()) {
- result.add(globalIDForObject(it.next()));
+ for (Object obj : anObjectList) {
+ result.add(globalIDForObject(obj));
}
return result;
}
@@ -492,6 +496,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* in this editing context if possible, calling to the parent object store only
* if such an object is not found.
*/
+ @Override
public void initializeObject(/* EOEnterpriseObject */ Object anObject, EOGlobalID aGlobalID,
EOEditingContext aContext) {
Object existingObject = registrar.objectForGlobalID(aGlobalID);
@@ -539,6 +544,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
deletedObjects.removeObjectAtIndex(index);
// if in the deleted ids buffer
+ // TODO is this
index = deletedIDsBuffer.indexOfIdenticalObject(anObject);
if (index != NSArray.NotFound) {
// remove from deleted ids buffer
@@ -587,6 +593,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* fetched the next time they are accessed, and calls
* invalidateObjectsWithGlobalIDs on the parent object store.
*/
+ @Override
public void invalidateAllObjects() {
// register change so processRecentChanges is called
willChange();
@@ -613,9 +620,9 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
// refault all objects
EOGlobalID id;
Object o;
- Enumeration e = ids.objectEnumerator();
+ Enumeration<EOGlobalID> e = ids.objectEnumerator();
while (e.hasMoreElements()) {
- id = (EOGlobalID) e.nextElement();
+ id = e.nextElement();
o = objectForGlobalID(id);
// some objects may have been manually discarded
@@ -645,6 +652,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* fetched the next time they are accessed, and forwards the call to the parent
* object store.
*/
+ @Override
public void invalidateObjectsWithGlobalIDs(List anArray) {
// register change so processRecentChanges is called
willChange();
@@ -654,9 +662,9 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
Object o;
EOGlobalID id;
- Iterator it = anArray.iterator();
+ Iterator<EOGlobalID> it = anArray.iterator();
while (it.hasNext()) {
- id = (EOGlobalID) it.next();
+ id = it.next();
if (id != null) {
o = objectForGlobalID(id);
if (o != null) {
@@ -688,6 +696,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Returns whether the object referenced by the specified id is locked. This
* implementation simply forwards the call to the parent object store.
*/
+ @Override
public boolean isObjectLockedWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
return parentStore.isObjectLockedWithGlobalID(aGlobalID, aContext);
}
@@ -709,6 +718,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* context. This implementation simply forwards the call to the parent object
* store.
*/
+ @Override
public void lockObjectWithGlobalID(EOGlobalID aGlobalID, EOEditingContext aContext) {
parentStore.lockObjectWithGlobalID(aGlobalID, aContext);
}
@@ -747,6 +757,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* specified relationship key must produce a result of type Collection for the
* source object or an exception is thrown.
*/
+ @Override
public NSArray objectsForSourceGlobalID(EOGlobalID aGlobalID, String aRelationshipKey, EOEditingContext aContext) {
//System.out.println( "EOEditingContext.objectsForSourceGlobalID: "
//+ aGlobalID + " : " + aRelationshipKey );
@@ -793,7 +804,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
} else // not NSArray
if (value instanceof Collection) {
// convert to NSArray
- result = new NSArray((Collection) value);
+ result = new NSArray((Collection<?>) value);
} else {
throw new WotonomyException(
"Relationship key did not return a collection: " + aGlobalID + " : " + aRelationshipKey);
@@ -825,6 +836,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* parent object store, which will register each object in the specified editing
* context only if it does not already exist.
*/
+ @Override
public NSArray objectsWithFetchSpecification(EOFetchSpecification aFetchSpec, EOEditingContext aContext) {
if (aContext == this) {
Object result = notifyDelegate("editingContextShouldFetchObjects",
@@ -869,7 +881,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
boolean postStoreInfo = (insertedObjectsBuffer.size() + updatedObjectsBuffer.size() + deletedIDsBuffer.size()
+ invalidatedIDsBuffer.size() > 0);
- NSMutableDictionary storeInfo = new NSMutableDictionary();
+ NSMutableDictionary<String, NSArray> storeInfo = new NSMutableDictionary<>();
if (postStoreInfo) {
storeInfo.setObjectForKey(globalIDsForObjects(insertedObjectsBuffer),
// globalIDsForObjects( insertedObjects ),
@@ -877,10 +889,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
storeInfo.setObjectForKey(globalIDsForObjects(updatedObjectsBuffer),
// globalIDsForObjects( updatedObjects ),
EOObjectStore.UpdatedKey);
- storeInfo.setObjectForKey(new NSArray((Collection) deletedIDsBuffer),
+ storeInfo.setObjectForKey(new NSArray((Collection<?>) deletedIDsBuffer),
// globalIDsForObjects( deletedObjects ),
EOObjectStore.DeletedKey);
- storeInfo.setObjectForKey(new NSArray((Collection) invalidatedIDsBuffer), EOObjectStore.InvalidatedKey);
+ storeInfo.setObjectForKey(new NSArray((Collection<?>) invalidatedIDsBuffer), EOObjectStore.InvalidatedKey);
}
// broadcast ObjectsChangedInEditingContextNotification
@@ -889,27 +901,27 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
boolean postContextInfo = (insertedObjectsBuffer.size() + updatedObjectsBuffer.size()
+ deletedObjectsBuffer.size() + invalidatedObjectsBuffer.size() > 0);
- NSMutableDictionary contextInfo = new NSMutableDictionary();
+ NSMutableDictionary<String, NSArray> contextInfo = new NSMutableDictionary<>();
if (postContextInfo) {
- contextInfo.setObjectForKey(new NSArray((Collection) insertedObjectsBuffer),
+ contextInfo.setObjectForKey(new NSArray((Collection<?>) insertedObjectsBuffer),
// new NSArray( (Collection) insertedObjects ),
EOObjectStore.InsertedKey);
- contextInfo.setObjectForKey(new NSArray((Collection) updatedObjectsBuffer),
+ contextInfo.setObjectForKey(new NSArray((Collection<?>) updatedObjectsBuffer),
// new NSArray( (Collection) updatedObjects ),
EOObjectStore.UpdatedKey);
- contextInfo.setObjectForKey(new NSArray((Collection) deletedObjectsBuffer),
+ contextInfo.setObjectForKey(new NSArray((Collection<?>) deletedObjectsBuffer),
// new NSArray( (Collection) deletedObjects ),
EOObjectStore.DeletedKey);
- contextInfo.setObjectForKey(new NSArray((Collection) invalidatedObjectsBuffer),
+ contextInfo.setObjectForKey(new NSArray((Collection<?>) invalidatedObjectsBuffer),
EOObjectStore.InvalidatedKey);
}
// update the current snapshots
Object o;
- Iterator it;
+ Iterator<Object> it;
it = insertedObjectsBuffer.iterator();
while (it.hasNext()) {
o = it.next();
@@ -1024,6 +1036,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Refaults the specified object, turning it into a fault for the specified
* global id in the specified context.
*/
+ @Override
public void refaultObject(Object anObject, EOGlobalID aGlobalID, EOEditingContext aContext) {
aContext.registrar.setCurrentSnapshot(anObject, null);
@@ -1052,7 +1065,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
Object o;
EOGlobalID id;
- Iterator it = registeredObjects().iterator();
+ Iterator<Object> it = registeredObjects().iterator();
while (it.hasNext()) {
o = it.next();
if ((updatedObjects.indexOfIdenticalObject(o) == NSArray.NotFound)
@@ -1088,9 +1101,9 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
return;
Object o;
- Iterator i = editorSet.iterator();
+ Iterator<WeakReference<Editor>> i = editorSet.iterator();
while (i.hasNext()) {
- o = ((WeakReference) i.next()).get();
+ o = i.next().get();
if ((o == null) || (o == anObject)) {
i.remove();
}
@@ -1102,7 +1115,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* timestamp.
*/
public void reset() {
- Iterator it = registeredObjects().iterator();
+ Iterator<Object> it = registeredObjects().iterator();
while (it.hasNext()) {
forgetObject(it.next());
}
@@ -1119,7 +1132,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
willChange();
fireWillSaveChanges();
- Iterator it;
+ Iterator<Object> it;
// forget inserted objects
it = new NSArray(insertedObjects).iterator();
@@ -1127,7 +1140,6 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
forgetObject(it.next());
}
- EOGlobalID id;
Object o;
byte[] snapshot;
@@ -1190,10 +1202,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
processRecentChanges();
// set up user info for notification to be posted.
- NSMutableDictionary userInfo = new NSMutableDictionary();
- userInfo.setObjectForKey(new NSArray((Collection) insertedObjects), EOObjectStore.InsertedKey);
- userInfo.setObjectForKey(new NSArray((Collection) updatedObjects), EOObjectStore.UpdatedKey);
- userInfo.setObjectForKey(new NSArray((Collection) deletedObjects), EOObjectStore.DeletedKey);
+ NSMutableDictionary<String, NSArray> userInfo = new NSMutableDictionary<>();
+ userInfo.setObjectForKey(new NSArray((Collection<?>) insertedObjects), EOObjectStore.InsertedKey);
+ userInfo.setObjectForKey(new NSArray((Collection<?>) updatedObjects), EOObjectStore.UpdatedKey);
+ userInfo.setObjectForKey(new NSArray((Collection<?>) deletedObjects), EOObjectStore.DeletedKey);
// notify the editors
fireWillSaveChanges();
@@ -1215,8 +1227,8 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
// no exceptions: proceed!
- Object o, key;
- Iterator it;
+ Object o;
+ Iterator<Object> it;
// update the committed snapshots
it = insertedObjects.iterator();
@@ -1249,12 +1261,13 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Commits all changes in the specified editing context to this one. Called by
* child editing contexts in their saveChanges() method.
*/
+ @Override
public void saveChangesInEditingContext(EOEditingContext aContext) {
Object o;
- Iterator it;
+ Iterator<Object> it;
// process deletes
- List deletes = new NSArray(aContext.deletedObjects());
+ List<Object> deletes = new NSArray(aContext.deletedObjects());
it = deletes.iterator();
while (it.hasNext()) {
o = it.next();
@@ -1276,7 +1289,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
// process inserts - all inserts are new objects
- List inserts = new NSArray(aContext.insertedObjects());
+ List<Object> inserts = new NSArray(aContext.insertedObjects());
it = inserts.iterator();
while (it.hasNext()) {
o = it.next();
@@ -1293,7 +1306,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
// process updates
- List updates = new NSArray(aContext.updatedObjects());
+ List<Object> updates = new NSArray(aContext.updatedObjects());
it = updates.iterator();
while (it.hasNext()) {
willChange(); // need to mark editing context as changed
@@ -1335,7 +1348,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
public void setDelegate(Object anObject) {
if (anObject == null)
delegate = null;
- delegate = new WeakReference(anObject);
+ delegate = new WeakReference<>(anObject);
}
/**
@@ -1442,7 +1455,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
*/
private void fireWillSaveChanges() {
Object o = null;
- Iterator i = editors().iterator();
+ Iterator<WeakReference<EOEditingContext.Editor>> i = editors().iterator();
while (i.hasNext()) {
try {
o = i.next();
@@ -1477,16 +1490,16 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
NSNotificationCenter.defaultCenter()
.postNotification(new NSNotification(InvalidatedAllObjectsInStoreNotification, this));
} else if (EOGlobalID.GlobalIDChangedNotification.equals(aNotification.name())) {
- NSDictionary userInfo = aNotification.userInfo();
+ NSDictionary<EOGlobalID, ?> userInfo = aNotification.userInfo();
// if any keys in userInfo are registered ids,
// re-register with new permanent values.
Object o;
EOGlobalID id;
- Enumeration e = userInfo.keyEnumerator();
+ Enumeration<EOGlobalID> e = userInfo.keyEnumerator();
while (e.hasMoreElements()) {
- id = (EOGlobalID) e.nextElement();
+ id = e.nextElement();
o = objectForGlobalID(id);
if (o != null) {
// record object is assumed to handle key updates
@@ -1501,16 +1514,16 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
Object o;
EOGlobalID id;
- Enumeration e;
- NSDictionary userInfo = aNotification.userInfo();
+ Enumeration<EOGlobalID> e;
+ NSDictionary<String, NSArray<EOGlobalID>> userInfo = (NSDictionary<String, NSArray<EOGlobalID>>) aNotification.userInfo();
// inserted objects are ignored
// existing deleted objects are removed
- NSArray deletes = (NSArray) userInfo.objectForKey(EOObjectStore.DeletedKey);
+ NSArray<EOGlobalID> deletes = userInfo.objectForKey(EOObjectStore.DeletedKey);
e = deletes.objectEnumerator();
while (e.hasMoreElements()) {
- id = (EOGlobalID) e.nextElement();
+ id = e.nextElement();
o = objectForGlobalID(id);
if (o != null) {
// System.out.println( "EOEditingContext: deleted: " + id );
@@ -1521,10 +1534,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
// existing updated objects are merged
- NSArray updates = (NSArray) userInfo.objectForKey(EOObjectStore.UpdatedKey);
+ NSArray<EOGlobalID> updates = userInfo.objectForKey(EOObjectStore.UpdatedKey);
e = updates.objectEnumerator();
while (e.hasMoreElements()) {
- id = (EOGlobalID) e.nextElement();
+ id = e.nextElement();
o = objectForGlobalID(id);
if (o != null) {
// System.out.println( "EOEditingContext: updated: " + id );
@@ -1540,10 +1553,10 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
// existing invalidated objects are refaulted
- NSArray invalidates = (NSArray) userInfo.objectForKey(EOObjectStore.InvalidatedKey);
+ NSArray<EOGlobalID> invalidates = userInfo.objectForKey(EOObjectStore.InvalidatedKey);
e = invalidates.objectEnumerator();
while (e.hasMoreElements()) {
- id = (EOGlobalID) e.nextElement();
+ id = e.nextElement();
o = objectForGlobalID(id);
if (o != null) {
if (updatedObjects // only invalidate if unchanged
@@ -1719,6 +1732,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* Implementation of the EOObserving interface. Called before objects are
* modified.
*/
+ @Override
public void objectWillChange(Object anObject) {
if (ignoreChanges)
return;
@@ -1812,6 +1826,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
* net.wotonomy.util.WotonomyException("Not implemented yet."); }
*/
+ @Override
public String toString() {
return "[EOEditingContext@" + Integer.toHexString(System.identityHashCode(this)) + ":" + " inserted="
+ idsForObjects(insertedObjects) + " updated=" + idsForObjects(updatedObjects) + " deleted="
@@ -2054,6 +2069,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
weakComparisonKey = new WeakReferenceKey();
}
+ @Override
public NSArray registeredObjects() {
Object object;
WeakReferenceKey weakKey;
@@ -2072,6 +2088,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
return result;
}
+ @Override
public Object objectForGlobalID(EOGlobalID aGlobalID) {
WeakReference ref = (WeakReference) super.objectForGlobalID(aGlobalID);
if (ref == null)
@@ -2089,11 +2106,13 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
return result;
}
+ @Override
public byte[] getCommitSnapshot(Object anObject) {
weakComparisonKey.set(anObject);
return (byte[]) objectsToCommitSnapshots.objectForKey(weakComparisonKey);
}
+ @Override
public void setCommitSnapshot(Object anObject, byte[] aSnapshot) {
if (aSnapshot == null) {
weakComparisonKey.set(anObject);
@@ -2103,11 +2122,13 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
}
+ @Override
public byte[] getCurrentSnapshot(Object anObject) {
weakComparisonKey.set(anObject);
return (byte[]) objectsToCurrentSnapshots.objectForKey(weakComparisonKey);
}
+ @Override
public void setCurrentSnapshot(Object anObject, byte[] aSnapshot) {
if (aSnapshot == null) {
weakComparisonKey.set(anObject);
@@ -2117,6 +2138,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
}
}
+ @Override
public void registerObject(Object anObject, EOGlobalID aGlobalID) { // new
// net.wotonomy.ui.swing.ReferenceInspector(
// anObject );
@@ -2125,6 +2147,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
EOObserverCenter.addObserver(context, anObject);
}
+ @Override
public void forgetObject(Object anObject) {
disposeObject(anObject, null);
}
@@ -2173,6 +2196,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
/**
* Returns the actual key's hash code.
*/
+ @Override
public int hashCode() {
return hashCode;
}
@@ -2180,6 +2204,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
/**
* Compares by reference.
*/
+ @Override
public boolean equals(Object anObject) {
if (anObject == this)
return true;
@@ -2203,10 +2228,12 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
super(anObject);
}
+ @Override
public Object get() {
return ((WeakReference) referent).get();
}
+ @Override
public void set(Object anObject) {
referent = new WeakReference(anObject);
hashCode = anObject.hashCode();
@@ -2215,6 +2242,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
/**
* Compares by reference.
*/
+ @Override
public boolean equals(Object anObject) {
if (anObject == this)
return true;
@@ -2242,10 +2270,12 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
hashCode = object.hashCode() + string.hashCode();
}
+ @Override
public int hashCode() {
return hashCode;
}
+ @Override
public boolean equals(Object anObject) {
if (anObject instanceof CompoundKey) {
CompoundKey key = (CompoundKey) anObject;
@@ -2254,6 +2284,7 @@ public class EOEditingContext extends EOObjectStore implements EOObserving {
return false;
}
+ @Override
public String toString() {
return "[CompoundKey:" + object + ":" + string + "]";
}