A simplest way to manage relationship?
A simplest way to manage relationship?
- Subject: A simplest way to manage relationship?
- From: DevReseune <email@hidden>
- Date: Sun, 9 Nov 2003 17:22:23 +0100
Hi,
EOF can manage relationship in both side with:
addObjectToBothSidesOfRelationshipWithKey. But, our interface is more
complicated now. This is another solution to manage relationship. It's
the work of the Eclipse group in the EMF project:
http://dev.eclipse.org/viewcvs/indextools.cgi/~checkout~/emf-home/
docs/overview.html
This the example:
The model is:
Book 0..* (books) -------------- 1 (author) Writer
In Book:
public void setAuthor(Writer newAuthor) {
if (newAuthor != author) {
if (author != null)
msgs = ((InternalEObject)author).eInverseRemove(this, ...);
if (newAuthor != null)
msgs = ((InternalEObject)newAuthor).eInverseAdd(this, ...);
msgs = basicSetAuthor(newAuthor);
}
}
and
public void basicSetAuthor(Writer newAuthor) {
Writer oldAuthor = author;
author = newAuthor;
}
It's simple! You only use:
aBook.setAuthor(anAuthor);
And all the relationship is managed!
So, my question is: why Apple added this way to manage relationship and
not an EMF solution-like? I find the EMF way simplest. And you?
Fridiric
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.