Project Wonder 2.0

er.extensions
Class ERXDictionaryUtilities

java.lang.Object
  extended byer.extensions.ERXDictionaryUtilities

public class ERXDictionaryUtilities
extends Object

Collection of NSDictionary utilities.


Constructor Summary
ERXDictionaryUtilities()
           
 
Method Summary
static NSDictionary dictionaryByRemovingFromDictionaryKeysInArray(NSDictionary d, NSArray a)
          Removes an array of keys from a dictionary and returns the result.
static NSDictionary dictionaryFromObjectWithKeys(Object object, NSArray keys)
          Creates a dictionary from an objects and an array of key paths
static NSDictionary dictionaryFromPropertyList(String name, NSBundle bundle)
          Creates an NSDictionary from a resource associated with a given bundle that is in property list format.
static NSDictionary dictionaryWithDictionaryAndDictionary(NSDictionary dict1, NSDictionary dict2)
          Creates an immutable dictionary containing all of the keys and objects from two dictionaries.
static NSDictionary dictionaryWithObjectsAndKeys(Object[] objectsAndKeys)
          Creates a dictionary from a list of alternating objects and keys starting with an object.
static NSDictionary removeNullValues(NSDictionary dict)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXDictionaryUtilities

public ERXDictionaryUtilities()
Method Detail

dictionaryWithDictionaryAndDictionary

public static NSDictionary dictionaryWithDictionaryAndDictionary(NSDictionary dict1,
                                                                 NSDictionary dict2)
Creates an immutable dictionary containing all of the keys and objects from two dictionaries.

Parameters:
dict1 - the first dictionary
dict2 - the second dictionary
Returns:
immutbale dictionary containing the union of the two dictionaries.

dictionaryFromPropertyList

public static NSDictionary dictionaryFromPropertyList(String name,
                                                      NSBundle bundle)
Creates an NSDictionary from a resource associated with a given bundle that is in property list format.

Parameters:
name - name of the file or resource.
bundle - NSBundle to which the resource belongs.
Returns:
NSDictionary de-serialized from the property list.

dictionaryWithObjectsAndKeys

public static NSDictionary dictionaryWithObjectsAndKeys(Object[] objectsAndKeys)
Creates a dictionary from a list of alternating objects and keys starting with an object.

Parameters:
objectsAndKeys - alternating list of objects and keys
Returns:
NSDictionary containing all of the object-key pairs.

dictionaryByRemovingFromDictionaryKeysInArray

public static NSDictionary dictionaryByRemovingFromDictionaryKeysInArray(NSDictionary d,
                                                                         NSArray a)
Removes an array of keys from a dictionary and returns the result.

Parameters:
d - dictionary to be pruned
a - array of keys to be pruned
Returns:
pruned dictionary

removeNullValues

public static NSDictionary removeNullValues(NSDictionary dict)
Returns:

dictionaryFromObjectWithKeys

public static NSDictionary dictionaryFromObjectWithKeys(Object object,
                                                        NSArray keys)
Creates a dictionary from an objects and an array of key paths

Parameters:
object - object to pull the values from
keys - array of keys
Returns:
NSDictionary containing all of the object-key pairs.

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

Copyright © 2002 – 2004 Project Wonder.