ERXKeyValueCodingUtilities Class Reference

Collaboration diagram for ERXKeyValueCodingUtilities:

Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static Object classValueForKey (Class clazz, String key)
static Field fieldForKey (Object target, String key)
static Method methodForKey (Object target, String key)
static Object privateValueForKey (Object target, String key)
static void registerClass (Class clazz)
static NSArray< ERXKeyValuePair > staticStringsForClass (Class c)
static void takeChangedValuesFromDictionary (Object object, NSDictionary< String,?> dictionary)
static void takePrivateValueForKey (Object target, Object value, String key)

Static Public Attributes

static final
NSKeyValueCodingAdditions 
Statics

Static Private Member Functions

static Field accessibleFieldForKey (Object target, String key)
static Method accessibleMethodForKey (Object target, String key)

Static Private Attributes

static Hashtable _classes = new Hashtable()


Detailed Description

Utilities for use with key value coding. You could instantiate one of these in your app-startup:

 ERXKeyValueCodingUtilities.registerClass(SomeClass.class); 
 NSKeyValueCodingAdditions statics = ERXKeyValueCodingUtilities.Statics;
 myValue = statics.valueForKeyPath("SomeClass.SOME_FIELD");
 
Also has utilities for getting and private fields and methods on an object.
Author:
ak

Member Function Documentation

static Field accessibleFieldForKey ( Object  target,
String  key 
) [static, private]

static Method accessibleMethodForKey ( Object  target,
String  key 
) [static, private]

static Object classValueForKey ( Class  clazz,
String  key 
) [static]

Extends key-value coding to a class. Java arrays and collections are morphed into NSArrays. The implementation is pretty slow, but I didn't exactly want to re-implement all of NSKeyValueCoding here.

Parameters:
clazz 
key 

static Field fieldForKey ( Object  target,
String  key 
) [static]

static Method methodForKey ( Object  target,
String  key 
) [static]

static Object privateValueForKey ( Object  target,
String  key 
) [static]

static void registerClass ( Class  clazz  )  [static]

Registers the class in the KVC resolving system, so you can use valueForKeyPath("MyClass.SOME_KEY"). Inner classes are registered with a "$", i.e. MyClass$InnerClass

Parameters:
clazz 

static NSArray<ERXKeyValuePair> staticStringsForClass ( Class  c  )  [static]

Returns final strings constants from an interface or class. Useful in particular when you want to create selection lists from your interfaces automatically.

Parameters:
c 

static void takeChangedValuesFromDictionary ( Object  object,
NSDictionary< String,?>  dictionary 
) [static]

 * Works like takeValuesFromDictionary, except that it only calls takeValueForKey if the current value  * is different than the new value.  *

Parameters:
object the object on which to operate
dictionary the key-value pairs to set  

static void takePrivateValueForKey ( Object  target,
Object  value,
String  key 
) [static]


Member Data Documentation

Hashtable _classes = new Hashtable() [static, private]

final NSKeyValueCodingAdditions Statics [static]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:13 2012 for Project Wonder by  doxygen 1.5.8