Project Wonder 2.0

er.extensions
Class ERXKeyValueCodingUtilities

java.lang.Object
  extended byer.extensions.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 void registerClass(Class clazz)
          Registers the class in the KVC resolving system, so you can use valueForKeyPath("MyClass.SOME_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. You can currently only get the static fields of the class, not method results. 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 -
Returns:

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.