Actually it should be NSDictionary<String, ? extends Object> or rather just NSDictionary<String, ?> probably in that case... Otherwise you can ONLY pass in literally an NSDictionary<String, Object> and not any subclasses of the values. In Wonder, you'll see our variants of these methods are:
public static String directActionUrl(WOContext context, String directActionName, NSDictionary<String, ? extends Object> queryParameters, Boolean secure, boolean includeSessionID)
I suppose you could argue that you should be instantiating an NSDictionary<String, Object> instead of a <String, String> but the method technically takes a map from String to any object type, so I think the ? better expresses the intent.
Incidentally, I was just parameterizing some methods in ERXArrayUtilities and, while generics look sort of ugly, they really do help in use:
public static NSDictionary arrayGroupedByKeyPath(NSArray objects, String keyPath, boolean includeNulls, String valueKeyPath) {
vs
public static <T, K, V> NSDictionary<K, NSArray<V>> arrayGroupedByKeyPath(NSArray<T> objects, ERXKey<K> keyPath, boolean includeNulls, ERXKey<V> valueKeyPath) {
I really like how explicit the the second one is ... You're going to get a dictionary back where the keys are the same type as the keypath you passed in and the values are the same type as the value key path you passed in ... Even without the added docs explaining what this does, you can almost guess by matching the types up with param types.
ms |