PATH Documentation > WebObjects

Table of Contents

EOKeyValueCoding.DefaultImplementation


Inherits from:
Object
Package:
com.webobjects.eocontrol


Class Description


EOKeyValueCoding.Support provides default implementations of the EOKeyValueCoding interface.

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
Handling error conditions
handleQueryWithUnboundKey


Static Methods



handleQueryWithUnboundKey

public static Object handleQueryWithUnboundKey( Object anObject, String key)

Throws an IllegalArgumentException.

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)



© 2001 Apple Computer, Inc. (Last Published April 19, 2001)


Table of Contents