Re: Setters, Getters and efficiency
Re: Setters, Getters and efficiency
- Subject: Re: Setters, Getters and efficiency
- From: mmalcolm crawford <email@hidden>
- Date: Sun, 11 Dec 2005 13:05:10 -0800
On Dec 11, 2005, at 12:07 PM, Jeff LaMarche wrote:
Isn't storedValueForKey: used instead of valueForKey: when
accessing attributes of an NSManagedObject (i.e when getting data
from Core Data)?
No, NSManagedObject does not use storedValueForKey:, which is
deprecated in 10.4 (see <
http://developer.apple.com/documentation/
Cocoa/Reference/Foundation/ObjC_classic/Protocols/
NSKeyValueCoding.html#//apple_ref/occ/instm/NSObject/
storedValueForKey:>. (The pattern is different in EOF, see <http://
developer.apple.com/documentation/WebObjects/Reference/API/com/
webobjects/eocontrol/EOKeyValueCoding.html>...) Core Data does
introduce "primitive accessors" -- see <
http://developer.apple.com/
documentation/Cocoa/Conceptual/CoreData/Articles/
cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154-SW5>, but:
<
http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSManagedObject.html#//apple_ref/occ/instm/
NSManagedObject/valueForKey:>
"This method is overridden by NSManagedObject to access the managed
object’s generic dictionary storage *unless* the receiver’s class
explicitly provides key-value coding compliant accessor methods for
key." My emphasis -- in other words, key-value coding compliant
accessor methods are given preference.
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden