PATH
Documentation > WebObjects 4.5 >
EOControl Reference
(informal protocol)
Declared in: - EOControl/EOKeyValueCoding.h
Protocol Description
The EOKeyValueCodingAdditions informal protocol defines extensions
to the basic EOKeyValueCoding informal protocol. One pair of methods, takeValuesFromDictionary: and valuesForKeys:,
gives access to groups of properties. Another pair of methods, takeValue:forKeyPath: and valueForKeyPath: give
access to properties across relationships with key paths of the
form relationship.property; for example,
"department.name". the Framework additions to NSObject provide
default implementations of EOKeyValueCodingAdditions, which you
rarely (if ever) need to override.
EONull in Collections
Because collection objects such as NSArray and NSDictionary
can't contain nil as a value, nil must be represented by a special
object, EONull. EONull provides a single instance that represents
the NULL value for object attributes. The default implementations
of takeValuesFromDictionary: and valuesForKeys: translate EONull
and nil
between NSDictionaries
and enterprise objects so your objects don't have to explicitly
test for EONull values.
Instance Methods
- (void)takeValue:(id)value
forKeyPath:(NSString *)keyPath
Sets the value for the property identified by keyPath to value.
A key path has the form relationship.property (with
one or more relationships); for example "movieRole.roleName"
or "movieRole.Talent.lastName". NSObject's implementation
of this method gets the destination object for each relationship
using valueForKey:, and sends the final
object a takeValue:forKey:message with value and property.
- (void)takeValuesFromDictionary:(NSDictionary
*)aDictionary
Sets properties of the receiver with values
from aDictionary, using its keys
to identify the properties. NSObject's implementation invokes takeValue:forKey: for each key-value
pair, substituting nil for EONull values in aDictionary.
- (id)valueForKeyPath:(NSString
*)keyPath
Returns the value for the derived property identified
by keyPath. A key path has the form relationship.property (with
one or more relationships); for example "movieRole.roleName"
or "movieRole.Talent.lastName". NSObject's implementation
of this method gets the destination object for each relationship
using valueForKey:, and returns the result
of a valueForKey: message to the final object.
- (NSDictionary *)valuesForKeys:(NSArray
*)keys
Returns a dictionary containing the property
values identified by each of keys. NSObject's implementation
invokes valueForKey: for each key in keys,
substituting EONull values in the dictionary for returned nil values.