< Previous PageNext Page > Hide TOC

Describing Property Relationships

Class descriptions provide a method of describing the to-one and to-many properties in a class. Defining these relationships between class properties allows for more intelligent and flexible manipulation of these properties with key-value coding.

Class Descriptions

NSClassDescription is a base class that provides the interface for obtaining meta-data about classes. A class description object records the available attributes of objects of a particular class and the relationships (one-to-one, one-to-many, and inverse) between objects of that class and other objects. For example the attributes method returns the list of all attributes defined for a class; the methods toManyRelationshipKeys and toOneRelationshipKeys return arrays of keys that define to-many and to-one relationships; and inverseRelationshipKey: returns the name of the relationship pointing back to the receiver from the destination of the relationship for the provided key.

NSClassDescription does not define methods for defining the relationships. Concrete subclasses must define these methods. Once created, you register a class description with the NSClassDescription registerClassDescription:forClass: class method.

NSScriptClassDescription is the only concrete subclass of NSClassDescription provided in Cocoa. It encapsulates an application’s scripting information.



< Previous PageNext Page > Hide TOC


© 2003, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.