ERXDictionaryUtilities Class Reference

List of all members.

Classes

class  NSDictionaryKeyValueComparator

Static Public Member Functions

static< K, V > void _removeMatchingEntries (NSMutableDictionary<?extends K,?extends V > snapshot1, NSMutableDictionary<?extends K,?extends V > snapshot2, boolean removeInverse)
static< K, V > NSDictionary< K, V > deepClone (NSDictionary< K, V > dict, boolean onlyCollections)
static< K, V > NSDictionary< K, V > dictionaryByRemovingFromDictionaryKeysInArray (NSDictionary< K, V > d, NSArray< K > a)
static< K, V > NSDictionary< K, V > dictionaryByRemovingKeysNotInArray (NSDictionary< K, V > d, NSArray< K > a)
static NSDictionary< String,
Object > 
dictionaryFromObjectWithKeys (Object object, NSArray< String > keys)
static NSDictionary dictionaryFromPropertyList (String name, NSBundle bundle)
static< K, V > NSDictionary< K, V > dictionaryWithDictionaryAndDictionary (NSDictionary<?extends K,?extends V > dict1, NSDictionary<?extends K,?extends V > dict2)
static NSDictionary dictionaryWithObjectsAndKeys (Object[] objectsAndKeys)
static< T > NSArray< T > keysSortedByValueAscending (final NSDictionary< T,?> d)
static String queryStringForDictionary (NSDictionary<?,?> dict, String separator, String encoding)
static String queryStringForDictionary (NSDictionary<?,?> dict, String separator)
static< K, V > void removeMatchingEntries (NSMutableDictionary<?extends K,?extends V > dict1, NSMutableDictionary<?extends K,?extends V > dict2)
static< K, V > NSDictionary< K, V > removeNullValues (NSDictionary< K, V > dict)
static< K, V > void setObjectForKeys (final NSMutableDictionary< K, V > dictionary, final V object, final NSArray< K > keys)
static NSArray< StringstringKeysSortedAscending (final NSDictionary< String,?> d)


Detailed Description

Collection of NSDictionary utilities.

Member Function Documentation

static <K,V> void _removeMatchingEntries ( NSMutableDictionary<?extends K,?extends V >  snapshot1,
NSMutableDictionary<?extends K,?extends V >  snapshot2,
boolean  removeInverse 
) [static]

static <K,V> NSDictionary<K, V> deepClone ( NSDictionary< K, V >  dict,
boolean  onlyCollections 
) [static]

Returns a deep clone of the given dictionary. A deep clone will attempt to clone the keys and values (deeply) of this dictionary as well as the dictionary itself.

Parameters:
dict the dictionary to clone
onlyCollections if true, only collections in this dictionary will be cloned, not individual values
Returns:
a deep clone of dict

static <K,V> NSDictionary<K, V> dictionaryByRemovingFromDictionaryKeysInArray ( NSDictionary< K, V >  d,
NSArray< K >  a 
) [static]

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

static <K,V> NSDictionary<K, V> dictionaryByRemovingKeysNotInArray ( NSDictionary< K, V >  d,
NSArray< K >  a 
) [static]

Creates a new dictionary with only the keys and objects in the array. The result is the objects for the intersection of keys in the dictionary and the array. This is the opposite of dictionaryByRemovingFromDictionaryKeysInArray.

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

static NSDictionary<String, Object> dictionaryFromObjectWithKeys ( Object  object,
NSArray< String keys 
) [static]

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.

static NSDictionary dictionaryFromPropertyList ( String  name,
NSBundle  bundle 
) [static]

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.

static <K,V> NSDictionary<K, V> dictionaryWithDictionaryAndDictionary ( NSDictionary<?extends K,?extends V >  dict1,
NSDictionary<?extends K,?extends V >  dict2 
) [static]

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.

static NSDictionary dictionaryWithObjectsAndKeys ( Object[]  objectsAndKeys  )  [static]

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.

static <T> NSArray<T> keysSortedByValueAscending ( final NSDictionary< T,?>  d  )  [static]

Parameters:
d dictionary to sort keys from
Returns:
keys from d sorted by ascending value they are mapped to

static String queryStringForDictionary ( NSDictionary<?,?>  dict,
String  separator,
String  encoding 
) [static]

Encodes a dictionary into a string that can be used in a request uri.

Parameters:
dict dictionary with form values
separator optional value separator

static String queryStringForDictionary ( NSDictionary<?,?>  dict,
String  separator 
) [static]

Encodes a dictionary into a string that can be used in a request uri.

Parameters:
dict dictionary with form values
separator optional value separator

static <K,V> void removeMatchingEntries ( NSMutableDictionary<?extends K,?extends V >  dict1,
NSMutableDictionary<?extends K,?extends V >  dict2 
) [static]

Removes entries from both dictionaries that match, leaving you with two dictionaries containing only values that did NOT match. Note that this comparison considers null == EO/NSKeyValueCoding.NullValue.

Parameters:
dict1 the first dictionary
dict2 the second dictionary

static <K,V> NSDictionary<K, V> removeNullValues ( NSDictionary< K, V >  dict  )  [static]

static <K,V> void setObjectForKeys ( final NSMutableDictionary< K, V >  dictionary,
final V  object,
final NSArray< K >  keys 
) [static]

Sets the object for each of the keys in the array on a mutable dictionary.

Parameters:
dictionary dictionary to mutate. a null dictionary is a no-op.
object object to set. an exception will be thrown if object is null.
keys array of keys to invoke setObjectForKey() for each key. a null or empty array is a no-op.

static NSArray<String> stringKeysSortedAscending ( final NSDictionary< String,?>  d  )  [static]


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

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