EOKeyValueCoding.Support
- Inherits from:
- Object
- Package:
- com.apple.client.eocontrol
Class Description
EOKeyValueCoding.Support provides default implementations of the EOKeyValueCoding interface.
Note: This class doesn't exist in the com.apple.yellow.eocontrol package. |
An EOCustomObject uses EOKeyValueCoding.Support's default implementations. Typically your custom enterprise object classes inherit from EOCustomObject and inherit the default implementations. EOKeyValueCoding.Support also enables you to put non-enterprise objects into the interface layer by declaring that your class conforms to key-value coding.
The methods in the Support class are just like the methods defined by the EOKeyValueCoding interface, except they are all static methods and they take an extra argument-the enterprise object on which the default implementation should operate. For example, suppose you want to implement an Employee enterprise object class that doesn't inherit from EOCustomObject but that uses Support's default implementations. Employee's valueForKey method would look like this:
public Object valueForKey(String key) return EOKeyValueCoding.Support.valueForKey(this, key); }
Method Types
- Accessing values
- storedValueForKey
- takeStoredValueForKey
- takeValueForKey
- valueForKey
- Handling error conditions
- handleQueryWithUnboundKey
- handleTakeValueForUnboundKey
- unableToSetNullForKey
Static Methods
handleQueryWithUnboundKey
public static Object
handleQueryWithUnboundKey
(
Object anObject,
String key)
See Also: handleQueryWithUnboundKey (EOKeyValueCoding)
handleTakeValueForUnboundKey
public static void
handleTakeValueForUnboundKey
(
Object anObject,
Object value,
String key)
See Also: handleTakeValueForUnboundKey (EOKeyValueCoding)
storedValueForKey
public static Object
storedValueForKey
(
Object anObject,
String key)
storedValueForKey
resolves key with
a different method-instance variable search order:- Searches
for a private accessor method based on key (a
method preceded by an underbar). For example, with a key of "lastName",
storedValueForKey
looks for a method named _getLastName or _lastName. - If a private accessor isn't found, searches for an instance
variable based on key and returns
its value directly. For example, with a key of "lastName",
storedValueForKey
looks for an instance variable named_lastName
orlastName
. - If neither a private accessor or an instance variable is found,
storedValueForKey
searches for a public accessor method based on key. For the key "lastName", this would be getLastName or lastName.
See Also: storedValueForKey (EOKeyValueCoding)
takeStoredValueForKey
public static void
takeStoredValueForKey
(
Object anObject,
Object value,
String key)
- Searches
for a private accessor method based on key (a
method preceded by an underbar). For example, with a key of "lastName",
takeStoredValueForKey
looks for a method named _setLastName. - If a private accessor isn't found, searches for an instance
variable based on key and sets its
value directly. For example, with a key of "lastName",
takeStoredValueForKey
looks for an instance variable named_lastName
orlastName
. - If neither a private accessor or an instance variable is found,
takeStoredValueForKey
searches for a public accessor method based on key. For the key "lastName", this would be setLastName.
See Also: takeStoredValueForKey (EOKeyValueCoding)
takeValueForKey
public static void
takeValueForKey
(
Object anObject,
Object value,
String key)
null
and key identifies
a scalar property. The default implementation works as follows:- Searches for a public accessor method of the form
set
Key, invoking it if there is one. - If a public accessor method isn't found, searches for a
private accessor method of the form
_set
Key, invoking it if there is one. - If an accessor method isn't found and the static method accessInstanceVariablesDirectly in anObject's
class returns
true
,takeValueForKey
searches for an instance variable based on key and sets the value directly. For the key "lastName", this would be_lastName
orlastName
.
See Also: takeValueForKey (EOKeyValueCoding)
unableToSetNullForKey
public static void
unableToSetNullForKey
(
Object anObject,
String key)
See Also: unableToSetNullForKey (EOKeyValueCoding)
valueForKey
public static Object
valueForKey
(
Object anObject,
String key)
- Searches
for a public accessor method based on key.
For example, with a key of "lastName",
valueForKey
- If a public accessor method isn't found, searches for a
private accessor method based on key (a method
preceded by an underbar). For example, with a key of "lastName",
valueForKey
looks for a method named _getLastName or _lastName. - If an accessor method isn't found and the static method accessInstanceVariablesDirectly in anObject's
class returns
true
,valueForKey
searches for an instance variable based on key and returns its value directly. For the key "lastName", this would be _lastName or lastName.
See Also: valueForKey (EOKeyValueCoding)