com.webobjects.foundation
Interface NSKeyValueCoding.ErrorHandling
- All Known Subinterfaces:
- EOEnterpriseObject, EOKeyValueCoding, EOKeyValueCodingAdditions
- All Known Implementing Classes:
- WODirectAction, WOComponent, WOHTTPConnection, WODisplayGroup, WOCookie, WOApplication, WOStatisticsStore, WOContext, WOMessage, WOSession, EOController
- Enclosing class:
- NSKeyValueCoding
- public static interface NSKeyValueCoding.ErrorHandling
The NSKeyValueCoding.ErrorHandling interface declares an
API for handling errors that occur during key-value coding.
If implemented, these methods allow customized handling error in the default implementation of key value coding.
- See Also:
NSKeyValueCoding
handleQueryWithUnboundKey
public Object handleQueryWithUnboundKey(String key)
- Invoked from
valueForKey
when it finds no property binding
for key
. The default implementation
throws an NSKeyValueCoding.UnknownKeyException,
with the target object(TargetObjectUserInfoKey)
and
key(UnknownUserInfokey)
in the user info. An NSKeyValueCoding.ErrorHandling class can override this
method to handle the query in some other way. The method can return a value,
in which case that value is returned by the corresponding
valueForKey
invocation.
- Parameters:
key
- the property name which generated this error- Returns:
- any Object or
null
that the custom implementation desires. The default implementation throws an exception instead. - Throws:
NSKeyValueCoding.UnknownKeyException
- when it finds no
property binding for key- See Also:
NSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
handleTakeValueForUnboundKey
public void handleTakeValueForUnboundKey(Object value,
String key)
- Invoked from
takeValueForKey
when it finds no property binding
for key
. The default implementation
throws an NSKeyValueCoding.UnknownKeyException, with the
target object(TargetObjectUserInfoKey)
and key(UnknownUserInfoKey)
in the user info dictionary of the exception. An NSKeyValueCoding.ErrorHandling class can override this
method to handle the error in some other way.
- Parameters:
value
- the new value which could not be setkey
- the name of the property which generated this error- Throws:
NSKeyValueCoding.UnknownKeyException
- when it finds
no property binding for key- See Also:
NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
unableToSetNullForKey
public void unableToSetNullForKey(String key)
- Invoked from
takeValueForKey
when it is given a null
value
for a scalar property (such as an int
or a float
).
The default implementation throws an IllegalArgumentException
.
You might want to implement the method (or override the inherited
implementation) to handle the request in some other way, such as by
substituting new Integer(0)
or a sentinel value and invoking takeValueForKey
again.
- Parameters:
key
- the name of the property which generated this error- Throws:
IllegalArgumentException
- when it is given a null value
for a scalar property- See Also:
NSKeyValueCoding.takeValueForKey(Object value, String key)
,
NSKeyValueCoding.DefaultImplementation
Copyright © 2003 Apple Computer, Inc.