Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

NSKeyValueCoding.UnknownKeyException


Inherits from:
RuntimeException
Package:
com.webobjects.foundation


Class Description


Instances of the NSKeyValueCoding. UnknownKeyException class are created and thrown when an unknown key is encountered during key-value coding.

For example, suppose an Employee object receives a valueForKey message with "partNumber" as the key. The Employee class doesn't declare a method or instance variable for "partNumber", so valueForKey throws an UnknownKeyException. An NSKeyValueCoding. UnknownKeyException has a userInfo dictionary containing entries for the object for which key-value coding failed ( TargetObjectUserInfoKey) and the unknown key ( UnknownUserInfoKey). For the Employee/partNumber example, the TargetObjectUserInfoKey entry would contain the Employee object and the UnknownUserInfoKey would contain the string "partNumber".

For more information on key-value coding and error conditions, see the NSKeyValueCoding and NSKeyValueCoding.ErrorHandling interface specifications.




Constants


NSKeyValueCoding. UnknownKeyException defines the following constants:


Constant Type Description
TargetObjectUserInfoKey String The key for an entry in the exception's user info dictionary. The entry contains the target object that does not implement the unknown key. This constant is deprecated. You should access this user info dictionary entry using the object method.
UnknownUserInfoKey String The key for an entry in the exception's user info dictionary. The entry contains the unknown key. This constant is deprecated. You should access this user info dictionary entry using the key method.



Constructors



NSKeyValueCoding.UnknownKeyException

public NSKeyValueCoding.UnknownKeyException( String message, Object anObject, String key)

Creates and returns a new UnknownKeyException with message as the message and a userInfo dictionary specifying anObject for the TargetObjectUserInfoKey and key for the UnknownUserInfoKey.

public NSKeyValueCoding.UnknownKeyException( String message, NSDictionary userInfo)

Deprecated in the Java Foundation framework. Don't use this method. Use NSKeyValueCoding.UnknownKeyException(String,Object,String) instead. Creates and returns a new UnknownKeyException with the specified message and userInfo dictionary.


Instance Methods



key

public String key()

Returns the unknown key that caused the exception to be thrown. Equivalent to getting the UnknownUserInfoKey entry from the userInfo dictionary.

object

public Object object()

Returns the object on which key-value coding was operating when an unknown key was encountered. Equivalent to getting the TargetObjectUserInfoKey entry from the userInfo dictionary.

userInfo

public NSDictionary userInfo()

Deprecated in the Java Foundation framework. Don't use this method. Use the object and key methods to access the exception's object and key instead. Returns the receiver's userInfo dictionary.

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


Table of Contents