|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSKeyValueCoding.DefaultImplementation
public static class NSKeyValueCoding.DefaultImplementation
The NSKeyValueCoding.DefaultImplementation class provides the WebObjects default implementations of the NSKeyValueCoding and NSKeyValueCoding.ErrorHandling interfaces.
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding
Method Summary | |
---|---|
static Object |
handleQueryWithUnboundKey(Object object,
String key)
Invoked from valueForKey when it finds no property binding for key . |
static void |
handleTakeValueForUnboundKey(Object object,
Object value,
String key)
Throws an NSKeyValueCoding.UnknownKeyException with object as the exception's object and key as the exception's key. |
static void |
takeValueForKey(Object object,
Object value,
String key)
Sets object 's property identified by key to value , or invokes handleTakeValueForUnboundKey . |
static void |
unableToSetNullForKey(Object object,
String key)
Invoked from takeValueForKey when it is given a null value for a scalar property (such as an int or a float ). |
static Object |
valueForKey(Object object,
String key)
Retrieves the value associated with the property named key on object . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Object valueForKey(Object object, String key)
key
on object
.
The default implementation searches first for a method and (if canAccessFieldsDirectly
is true) for instance variables matching key
. For example, for key "foo" the search order is as follows: (a) method "getFoo"; (b) method "foo"; (c) method "isFoo"; (d)
method "_getFoo"; (e) method "_foo"; (f) method "_isFoo"; (g) field "_foo"; (h) field "_isFoo"; (i) field "foo"; (j) field "isFoo". If an unknown key is encountered and the object implements the NSKeyValueCoding.ErrorHandling interface, handleQueryWithUnboundKey is invoked, otherwise a
NSKeyValueCoding.UnknownKeyException is raised.
object
- the object to operate uponkey
- identifies the property to retrieve
object
's value for the property identified by key
, or invokes handleQueryWithUnboundKey
NSKeyValueCoding.valueForKey(java.lang.String)
public static void takeValueForKey(Object object, Object value, String key)
object
's property identified by key
to value
, or invokes handleTakeValueForUnboundKey
.
The default implementation searches for a method or instance variable fitting a pattern for the key. For example, for key "foo" the search order is as follows: (a) method "setFoo"; (b) method "_setFoo"; (c) field "_foo"; (d) field "_isFoo"; (e) field "foo"; (f) field "isFoo". If an unknown key is encountered and the object implements the NSKeyValueCoding.ErrorHandling interface, handleTakeValueForUnboundKey is invoked, otherwise a NSKeyValueCoding.UnknownKeyException is raised.
object
- object whose property is set to valuevalue
- key is set to this valuekey
- identifies the property of an objectNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
public static Object handleQueryWithUnboundKey(Object object, String key)
valueForKey
when it finds no property binding for key
. The default implementation raises an NSKeyValueCoding.UnknownKeyException.
object
- the object involved in the errorkey
- the key which generated the bad query
an
- NSKeyValueCoding.UnknownKeyException with object
as the exception's object and key
as the exception's keyNSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding.UnknownKeyException
public static void handleTakeValueForUnboundKey(Object object, Object value, String key)
object
as the exception's object and key
as the exception's key. Invoked from takeValueForKey
when it finds no property binding for key
. The default implementation raises an
NSKeyValueCoding.UnknownKeyException
object
- the object involved in the errorvalue
- the value which could not be setkey
- the key which generated the error
NSKeyValueCoding.UnknownKeyException
- when it finds no property binding for keyNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.ErrorHandling
public static void unableToSetNullForKey(Object object, String key)
takeValueForKey
when it is given a null
value for a scalar property (such as an int
or a float
). The default implementation raises an IllegalArgumentException.
object
- the object whose value is to be setkey
- the key which generated the error
IllegalArgumentException
- when it is given a null value for a scalar propertyNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.ErrorHandling
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |