Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOControl Reference

Table of Contents

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)

Throws an IllegalArgumentException.

See Also: handleQueryWithUnboundKey (EOKeyValueCoding)



handleTakeValueForUnboundKey

public static void handleTakeValueForUnboundKey( Object anObject, Object value, String key)

Throws an IllegalArgumentException.

See Also: handleTakeValueForUnboundKey (EOKeyValueCoding)



storedValueForKey

public static Object storedValueForKey( Object anObject, String key)

Returns anObject's property identified by key. Similar to the implementation of valueForKey, but storedValueForKey resolves key with a different method-instance variable search order:
  1. 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.
  2. 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 or lastName.
  3. 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)

Sets anObject's property identified by key to value. Similar to the implementation of takeValueForKey, but it resolves key with a different method-instance variable search order:
  1. 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.
  2. 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 or lastName.
  3. 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)

Sets anObject's property identified by key to value, invoking handleTakeValueForUnboundKey if the receiver doesn't recognize key and unableToSetNullForKey if value is null and key identifies a scalar property. The default implementation works as follows:
  1. Searches for a public accessor method of the form set Key, invoking it if there is one.
  2. 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.
  3. 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 or lastName.

See Also: takeValueForKey (EOKeyValueCoding)



unableToSetNullForKey

public static void unableToSetNullForKey( Object anObject, String key)

Throws an IllegalArgumentException.

See Also: unableToSetNullForKey (EOKeyValueCoding)



valueForKey

public static Object valueForKey( Object anObject, String key)

Returns the value for the property identified by key, invoking handleQueryWithUnboundKey if the receiver doesn't recognize key. The default implementation works as follows:
  1. Searches for a public accessor method based on key. For example, with a key of "lastName", valueForKey looks for a method named getLastName or lastName.
  2. 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.
  3. 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)




Table of Contents