Re: Many to many relationship... some problem
Re: Many to many relationship... some problem
- Subject: Re: Many to many relationship... some problem
- From: Ray Kiddy <email@hidden>
- Date: Tue, 11 Aug 2009 11:31:34 -0700
On Aug 11, 2009, at 10:15 AM, Ricardo J. Parada wrote:
On Aug 11, 2009, at 12:59 PM, Ray Kiddy wrote:
It is not documented, AFAIK, but I believe that "ordine" would be
found before "getOrdine".
According to :
http://developer.apple.com/documentation/MacOSXServer/Reference/WO54_Reference/com/webobjects/foundation/NSKeyValueCoding.DefaultImplementation.html#valueForKey(java.lang.Object, java.lang.String)
I think getFoo() will get called first.
Yes, that may be implied by the doc. But I do not trust implication.
On the other hand, testing proves you are right. This test, soon to be
checked in to ProjectWonder, passes.
cheers - ray
package com.webobjects.foundation;
import com.webobjects.foundation.NSKeyValueCoding;
import junit.framework.Assert;
import junit.framework.TestCase;
public class NSKeyValueCodingTest extends TestCase {
public void testValueForKey() {
Assert.assertEquals( "getIvar", (new
KVC001()).valueForKey("ivar") );
Assert.assertEquals( "ivar", (new
KVC002()).valueForKey("ivar") );
Assert.assertEquals( "isIvar", (new
KVC003()).valueForKey("ivar") );
try {
Assert.assertEquals( null, (new
KVC004()).valueForKey("ivar") );
Assert.fail("KVC004 should have thrown
UnknownKeyException");
} catch
(com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException e) { }
}
class KVC001 implements NSKeyValueCoding {
public Object valueForKey(String key) { return
NSKeyValueCoding.DefaultImplementation.valueForKey(this, key); }
public void takeValueForKey(Object value, String key)
{ NSKeyValueCoding.DefaultImplementation.takeValueForKey(this, value,
key); }
public Object getIvar() { return "getIvar"; }
public Object ivar() { return "ivar"; }
public Object isIvar() { return "isIvar"; }
}
class KVC002 implements NSKeyValueCoding {
public Object valueForKey(String key) { return
NSKeyValueCoding.DefaultImplementation.valueForKey(this, key); }
public void takeValueForKey(Object value, String key)
{ NSKeyValueCoding.DefaultImplementation.takeValueForKey(this, value,
key); }
public Object ivar() { return "ivar"; }
public Object isIvar() { return "isIvar"; }
}
class KVC003 implements NSKeyValueCoding {
public Object valueForKey(String key) { return
NSKeyValueCoding.DefaultImplementation.valueForKey(this, key); }
public void takeValueForKey(Object value, String key)
{ NSKeyValueCoding.DefaultImplementation.takeValueForKey(this, value,
key); }
public Object isIvar() { return "isIvar"; }
}
class KVC004 implements NSKeyValueCoding {
public Object valueForKey(String key) { return
NSKeyValueCoding.DefaultImplementation.valueForKey(this, key); }
public void takeValueForKey(Object value, String key)
{ NSKeyValueCoding.DefaultImplementation.takeValueForKey(this, value,
key); }
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden