Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EOKeyValueCodingAdditions.Utility


Inherits from:
Object
Package:
com.webobjects.eocontrol


Class Description


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

Utility's methods are just like the methods defined by the EOKeyValueCodingAdditions 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 EOKeyValueCodingAdditions object and invoke the corresponding EOKeyValueCodingAdditions 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 EOKeyValueCodingAdditions API but you don't know if the object is an EOKeyValueCodingAdditions object. To do so, you simply use the corresponding Utility API, as in the following line of code:


values = EOKeyValueCodingAdditions.Utility.valuesForKeys(object, keys);

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


if (object instanceof EOKeyValueCodingAdditions) {
    values = ((EOKeyValueCodingAdditions)object).valuesForKeys(keys);
} else {
    values = EOKeyValueCodingAdditions.DefaultImplementation.valuesForKeys(         object, keys);
}




Instance Methods



takeValuesFromDictionary

public abstract void takeValuesFromDictionary( Object object, NSDictionary dictionary)

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

valuesForKeys

public abstract NSDictionary valuesForKeys( Object object, NSArray keys)

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

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


Table of Contents