PATH Documentation > WebObjects

Table of Contents

EOKeyValueCoding.Utility


Inherits from:
Object
Package:
com.webobjects.eocontrol


Class Description


The EOKeyValueCoding.Utility class is a convenience that allows you to access the properties of EOKeyValueCoding objects and non-EOKeyValueCoding objects using the same code.

Utility's methods are just like the methods defined by the EOKeyValueCoding interface, except they are static methods and they take an extra argument-the object on which the method should operate. Utility's methods simply check to see if the object on which they operate is an EOKeyValueCoding object and invoke the corresponding EOKeyValueCoding method on the object if it is. Otherwise, they invoke the corresponding DefaultImplementation method (formerly implemented in the Support class), passing the object on which to operate.

For example, suppose that you want to access an object with the EOKeyValueCoding API but you don't know if the object is an EOKeyValueCoding object. To do so, you simply use the corresponding Utility API, as in the following line of code:


theValue = EOKeyValueCoding.Utility.storedValueForKey(object, key);

The above line of code is simply a short-cut for the following:


if (object instanceof EOKeyValueCoding) {
    theValue = ((EOKeyValueCoding)object).storedValueForKey(key);
} else {
    theValue = EOKeyValueCoding.DefaultImplementation.storedValueForKey(         object, key);
}




Static Methods



storedValueForKey

public static Object storedValueForKey(Object object, String key)

If the specified object is an EOKeyValueCoding object, invokes storedValueForKey on that object; otherwise invokes EOKeyValueCoding.DefaultImplementation's storedValueForKey method with the object as the object on which to operate.

decodeWithKeyValueUnarchiver

public static void takeStoredValueForKey(Object object, Object value, String key)

If the specified object is an EOKeyValueCoding object, invokes takeStoredValueForKey on that object; otherwise invokes EOKeyValueCoding.DefaultImplementation's takeStoredValueForKey method with the object as the object on which to operate.

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


Table of Contents