Project Wonder 5.0.0.8795

er.extensions.foundation
Class ERXKeyValueCodingUtilities

java.lang.Object
  extended by er.extensions.foundation.ERXKeyValueCodingUtilities

public class ERXKeyValueCodingUtilities
extends Object

Utilities for use with key value coding. You could instantiate one of these in your app-startup: public NSKeyValueCodingUtilities statics = ERXKeyValueCodingUtilities.Statics; ERXKeyValueCodingUtilities.registerClass(SomeClass.class); myValue = valueForKeyPath("statics.SomeClass.SOME_FIELD");

Author:
ak

Field Summary
static NSKeyValueCodingAdditions Statics
           
 
Constructor Summary
ERXKeyValueCodingUtilities()
           
 
Method Summary
static Object classValueForKey(Class clazz, String key)
          Extends key-value coding to a class.
static Field fieldForKey(Object target, String key)
           
static Object privateValueForKey(Object target, String key)
           
static void registerClass(Class clazz)
          Registers the class in the KVC resolving system, so you can use valueForKeyPath("MyClass.SOME_KEY").
static NSArray<ERXKeyValuePair> staticStringsForClass(Class c)
          Returns final strings constants from an interface or class.
static void takePrivateValueForKey(Object target, Object value, String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Statics

public static final NSKeyValueCodingAdditions Statics
Constructor Detail

ERXKeyValueCodingUtilities

public ERXKeyValueCodingUtilities()
Method Detail

registerClass

public static void registerClass(Class clazz)
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 -

classValueForKey

public static Object classValueForKey(Class clazz,
                                      String key)
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 -

staticStringsForClass

public static NSArray<ERXKeyValuePair> staticStringsForClass(Class c)
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 -

privateValueForKey

public static Object privateValueForKey(Object target,
                                        String key)

takePrivateValueForKey

public static void takePrivateValueForKey(Object target,
                                          Object value,
                                          String key)

fieldForKey

public static Field fieldForKey(Object target,
                                String key)

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.