net.wotonomy.control
Class KeyValueCodingUtilities

java.lang.Object
  extended by net.wotonomy.control.KeyValueCodingUtilities

public class KeyValueCodingUtilities
extends java.lang.Object

KeyValueCodingUtilities implements what EOKeyValueCodingSupport leaves out. Importantly, this class implements the deep clone and deep copy operations that are essential to the functioning of nested editing contexts.

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

Constructor Summary
KeyValueCodingUtilities()
           
 
Method Summary
static java.lang.Object clone(EOEditingContext aSourceContext, java.lang.Object aSource, EOEditingContext aDestinationContext)
          Creates a deep clone of the specified object, registered in the specified source editing context, transposing it into the specified destination editing context.
static java.lang.Object clone(java.lang.Object aSource)
          Creates a deep clone of the specified object.
static java.lang.Object copy(EOEditingContext aSourceContext, java.lang.Object aSource, EOEditingContext aDestinationContext, java.lang.Object aDestination)
          Copies values from one object registered in the specified origin context to the specified destination object The values themselves are cloned, so this is a deep copy.
static java.lang.Object copy(java.lang.Object aSource, java.lang.Object aDestination)
          Copies values from one object registered in the specified origin context to the specified destination object The values themselves are cloned, so this is a deep copy.
static byte[] freeze(java.lang.Object anObject, EOEditingContext aContext, java.lang.Object aRootObject, boolean transpose)
          Serializes an object to a byte array containing GlobalIDMarkers in place of references to other objects registered in the specified context.
static net.wotonomy.foundation.NSDictionary storedValuesForKeys(java.lang.Object anObject, java.util.List aKeyList)
          Returns a Map of the specified keys to their values, each of which is obtained by calling storedValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport.
static void takeStoredValuesFromDictionary(java.lang.Object anObject, java.util.Map aMap)
          Takes the keys from the specified Map as properties and applies the corresponding values, each of which might be set by calling takeStoredValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport.
static void takeValuesFromDictionary(java.lang.Object anObject, java.util.Map aMap)
          Takes the keys from the specified Map as properties and applies the corresponding values, each of which might be set by calling takeValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport.
static java.lang.Object thaw(byte[] aByteArray, EOEditingContext aContext, boolean transpose)
          De-serializes an object from the specified byte array, replacing GlobalIDMarkers with reference to objects registered in the specified editing context.
static java.lang.Object thaw(byte[] aByteArray, EOEditingContext aContext, java.lang.ClassLoader aLoader, boolean transpose)
          De-serializes an object from the specified byte array, replacing GlobalIDMarkers with reference to objects registered in the specified editing context.
static net.wotonomy.foundation.NSDictionary valuesForKeys(java.lang.Object anObject, java.util.List aKeyList)
          Returns a Map of the specified keys to their values, each of which is obtained by calling valueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyValueCodingUtilities

public KeyValueCodingUtilities()
Method Detail

valuesForKeys

public static net.wotonomy.foundation.NSDictionary valuesForKeys(java.lang.Object anObject,
                                                                 java.util.List aKeyList)
Returns a Map of the specified keys to their values, each of which is obtained by calling valueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport. Null values must be represented by NSNull.nullValue().


storedValuesForKeys

public static net.wotonomy.foundation.NSDictionary storedValuesForKeys(java.lang.Object anObject,
                                                                       java.util.List aKeyList)
Returns a Map of the specified keys to their values, each of which is obtained by calling storedValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport. Null values must be represented by NSNull.nullValue().


takeValuesFromDictionary

public static void takeValuesFromDictionary(java.lang.Object anObject,
                                            java.util.Map aMap)
Takes the keys from the specified Map as properties and applies the corresponding values, each of which might be set by calling takeValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport. Null values must be represented by NSNull.nullValue().


takeStoredValuesFromDictionary

public static void takeStoredValuesFromDictionary(java.lang.Object anObject,
                                                  java.util.Map aMap)
Takes the keys from the specified Map as properties and applies the corresponding values, each of which might be set by calling takeStoredValueForKey on the specified object if it implements EOKeyValueCoding, and otherwise falling back on EOKeyValueCodingSupport. Null values must be represented by NSNull.nullValue().


clone

public static java.lang.Object clone(java.lang.Object aSource)
Creates a deep clone of the specified object. (Object.clone() only creates a shallow clone.) Returns null if operation fails.


clone

public static java.lang.Object clone(EOEditingContext aSourceContext,
                                     java.lang.Object aSource,
                                     EOEditingContext aDestinationContext)
Creates a deep clone of the specified object, registered in the specified source editing context, transposing it into the specified destination editing context. Returns null if operation fails.


freeze

public static byte[] freeze(java.lang.Object anObject,
                            EOEditingContext aContext,
                            java.lang.Object aRootObject,
                            boolean transpose)
Serializes an object to a byte array containing GlobalIDMarkers in place of references to other objects registered in the specified context. The specified root object will be serialized, even if it is registered in the specified context: this is typically the root object you're trying to serialize. Package access, as this method is used by editing context for snapshots.


thaw

public static java.lang.Object thaw(byte[] aByteArray,
                                    EOEditingContext aContext,
                                    boolean transpose)
De-serializes an object from the specified byte array, replacing GlobalIDMarkers with reference to objects registered in the specified editing context. Package access, as this method is used by editing context for snapshots.


thaw

public static java.lang.Object thaw(byte[] aByteArray,
                                    EOEditingContext aContext,
                                    java.lang.ClassLoader aLoader,
                                    boolean transpose)
De-serializes an object from the specified byte array, replacing GlobalIDMarkers with reference to objects registered in the specified editing context. Package access, as this method is used by editing context for snapshots.


copy

public static java.lang.Object copy(java.lang.Object aSource,
                                    java.lang.Object aDestination)
Copies values from one object registered in the specified origin context to the specified destination object The values themselves are cloned, so this is a deep copy. Returns the destination object, or throws exception if operation fails.


copy

public static java.lang.Object copy(EOEditingContext aSourceContext,
                                    java.lang.Object aSource,
                                    EOEditingContext aDestinationContext,
                                    java.lang.Object aDestination)
Copies values from one object registered in the specified origin context to the specified destination object The values themselves are cloned, so this is a deep copy. Returns the destination object, or throws exception if operation fails.



Copyright © 2006 null. All Rights Reserved.