net.wotonomy.foundation
Interface NSKeyValueCoding

All Known Subinterfaces:
NSKeyValueCodingAdditions
All Known Implementing Classes:
NSDictionary, NSMutableDictionary

public interface NSKeyValueCoding

NSKeyValueCoding defines an interface for classes that need to have more control over the wotonomy's property introspection facilities.

On an object that implements this interface, wotonomy will call these methods, and otherwise use the static methods on NSKeyValueCodingSupport.

NSKeyValueCodingSupport implements the default behaviors for each of these methods, so classes implementing this interface can call those methods to acheive the same behavior.

valueForKey and takeValueForKey are called in response to user actions, like viewing an object or updating its value in a user interface. These should call the public getter and setter methods on the object itself and the operations should be subject to validation.

storedValueForKey and takeStoredValueForKey are called in response to wotonomy actions, like snapshotting, faulting, commits, and reverts. These operations should bypass the public methods and directly modify the internal state of the object without validation.

Version:
$Revision: 893 $
Author:
michael@mpowers.net, $Author: cgruber $

Nested Class Summary
static class NSKeyValueCoding.DefaultImplementation
           
static class NSKeyValueCoding.Null
           
static class NSKeyValueCoding.Utility
          Static utility methods that call the appropriate method if the object implements NSKeyValueCoding, otherwise calls the method on DefaultImplementation.
 
Field Summary
static NSKeyValueCoding.Null NullValue
           
 
Method Summary
 java.lang.Object handleQueryWithUnboundKey(java.lang.String aKey)
          Called by valueForKey when the specified key is not found on this object.
 void handleTakeValueForUnboundKey(java.lang.Object aValue, java.lang.String aKey)
          Called by takeValueForKey when the specified key is not found on this object.
 java.lang.Object storedValueForKey(java.lang.String aKey)
          Returns the value for the private field that corresponds to the specified property.
 void takeStoredValueForKey(java.lang.Object aValue, java.lang.String aKey)
          Sets the the private field that corresponds to the specified property to the specified value.
 void takeValueForKey(java.lang.Object aValue, java.lang.String aKey)
          Sets the property to the specified value.
 void unableToSetNullForKey(java.lang.String aKey)
          Called by takeValueForKey when the type of the specified key is not allowed to be null, as is the case with primitive types.
 java.lang.Object valueForKey(java.lang.String aKey)
          Returns the value for the specified property.
 

Field Detail

NullValue

static final NSKeyValueCoding.Null NullValue
Method Detail

valueForKey

java.lang.Object valueForKey(java.lang.String aKey)
Returns the value for the specified property. If the property does not exist, this method should call handleQueryWithUnboundKey.


takeValueForKey

void takeValueForKey(java.lang.Object aValue,
                     java.lang.String aKey)
Sets the property to the specified value. If the property does not exist, this method should call handleTakeValueForUnboundKey. If the property is of a type that cannot allow null (e.g. primitive types) and aValue is null, this method should call unableToSetNullForKey.


storedValueForKey

java.lang.Object storedValueForKey(java.lang.String aKey)
Returns the value for the private field that corresponds to the specified property.


takeStoredValueForKey

void takeStoredValueForKey(java.lang.Object aValue,
                           java.lang.String aKey)
Sets the the private field that corresponds to the specified property to the specified value.


handleQueryWithUnboundKey

java.lang.Object handleQueryWithUnboundKey(java.lang.String aKey)
Called by valueForKey when the specified key is not found on this object. Implementing classes should handle the specified value or otherwise throw an exception.


handleTakeValueForUnboundKey

void handleTakeValueForUnboundKey(java.lang.Object aValue,
                                  java.lang.String aKey)
Called by takeValueForKey when the specified key is not found on this object. Implementing classes should handle the specified value or otherwise throw an exception.


unableToSetNullForKey

void unableToSetNullForKey(java.lang.String aKey)
Called by takeValueForKey when the type of the specified key is not allowed to be null, as is the case with primitive types. Implementing classes should handle this case appropriately or otherwise throw an exception.



Copyright © 2006 null. All Rights Reserved.