WebObjects 5.4.2

com.webobjects.foundation
Class NSKeyValueCoding.UnknownKeyException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException
All Implemented Interfaces:
Serializable
Enclosing interface:
NSKeyValueCoding

public static class NSKeyValueCoding.UnknownKeyException
extends RuntimeException

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 does not declare a method or instance variable for "partNumber", so valueForKey throws an UnknownKeyException. An NSKeyValueCoding.UnknownKeyException has a user info 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".

See Also:
NSKeyValueCoding.UnknownKeyException.object(), NSKeyValueCoding.UnknownKeyException.key(), NSKeyValueCoding.valueForKey, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, Serialized Form

Field Summary
static String TargetObjectUserInfoKey
          Deprecated. this user info dictionary entry should be accessed using the object method.
static String UnknownUserInfoKey
          Deprecated. this user info dictionary entry should be accessed using the key method.
 
Constructor Summary
NSKeyValueCoding.UnknownKeyException(String message, NSDictionary userInfo)
          Deprecated. Use NSKeyValueCoding.UnknownKeyException.NSKeyValueCoding.UnknownKeyException(java.lang.String, java.lang.Object, java.lang.String) instead.
NSKeyValueCoding.UnknownKeyException(String message, Object object, String key)
          Creates and returns a new UnknownKeyException with message as the message and a user info dictionary specifying object for the TargetObjectUserInfoKey and key for the UnknownUserInfoKey.
 
Method Summary
 String key()
          This method returns the key that NSKeyValueCoding operations were using at the time of the error, or null if it is unavailable.
 Object object()
          This method returns the value that NSKeyValueCoding operations were using at the time of the error, or null if it is unavailable.
 String toString()
           
 NSDictionary userInfo()
          Deprecated. The object and key methods should be used instead
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TargetObjectUserInfoKey

@Deprecated
public static final String TargetObjectUserInfoKey
Deprecated. this user info dictionary entry should be accessed using the object method.
See Also:
NSKeyValueCoding.UnknownKeyException.object(), Constant Field Values

UnknownUserInfoKey

@Deprecated
public static final String UnknownUserInfoKey
Deprecated. this user info dictionary entry should be accessed using the key method.
See Also:
NSKeyValueCoding.UnknownKeyException.key(), Constant Field Values
Constructor Detail

NSKeyValueCoding.UnknownKeyException

public NSKeyValueCoding.UnknownKeyException(String message,
                                            Object object,
                                            String key)
Creates and returns a new UnknownKeyException with message as the message and a user info dictionary specifying object for the TargetObjectUserInfoKey and key for the UnknownUserInfoKey.

Parameters:
message - the message created and return
object - object specified for the TargetObjectUserInfoKey. It may be null
key - identifies the property of an object. It may be null
See Also:
NSKeyValueCoding.UnknownKeyException.object(), NSKeyValueCoding.UnknownKeyException.key()

NSKeyValueCoding.UnknownKeyException

@Deprecated
public NSKeyValueCoding.UnknownKeyException(String message,
                                                       NSDictionary userInfo)
Deprecated. Use NSKeyValueCoding.UnknownKeyException.NSKeyValueCoding.UnknownKeyException(java.lang.String, java.lang.Object, java.lang.String) instead.

Parameters:
message - A message or summary associated with the new exception
userInfo - the user info dictionary containing more information about the error
See Also:
NSKeyValueCoding.UnknownKeyException.NSKeyValueCoding.UnknownKeyException(String, Object, String), NSKeyValueCoding.UnknownKeyException.TargetObjectUserInfoKey, NSKeyValueCoding.UnknownKeyException.UnknownUserInfoKey
Method Detail

object

public Object object()
This method returns the value that NSKeyValueCoding operations were using at the time of the error, or null if it is unavailable. This is equivalent to getting the TargetObjectUserInfoKey entry from the userInfo dictionary.

Returns:
the object on which key-value coding was operating when an unknown key was encountered
See Also:
NSKeyValueCoding.UnknownKeyException.TargetObjectUserInfoKey

key

public String key()
This method returns the key that NSKeyValueCoding operations were using at the time of the error, or null if it is unavailable. This is equivalent to getting the UnknownUserInfoKey entry from the userInfo dictionary.

Returns:
the unknown key that caused the exception to be thrown
See Also:
NSKeyValueCoding.UnknownKeyException.UnknownUserInfoKey

userInfo

@Deprecated
public NSDictionary userInfo()
Deprecated. The object and key methods should be used instead

Returns:
the userInfo dictionary associated with this exception
See Also:
NSKeyValueCoding.UnknownKeyException.object(), NSKeyValueCoding.UnknownKeyException.key()

toString

public String toString()
Overrides:
toString in class Throwable

Last updated June 2008

Copyright © 2000-2008 Apple Inc.