Re: API deprecation request
Re: API deprecation request
- Subject: Re: API deprecation request
- From: "Michael DeMan (WO)" <email@hidden>
- Date: Thu, 12 Mar 2009 23:58:40 -0700
Also, just realized I had a (at least one) typo:
OLD:
That the method signatures as-are do not adequately describe the
behavior of the method given the implicit cast of the KVC value from its
true value to its 'toString' value. Current method signatures imply
that the WebObjects KVC will honor 'equals()', which it does not.
NEW:
That the method signatures as-are do not adequately describe the
behavior of the method given the implicit cast of the KVC value from its
true value to its 'toString' value. Current method signatures imply
that the ERX method will honor 'equals()', which it does not, and WO/EOF
is required to.
Michael DeMan (WO) wrote:
Hi All,
Two caveats before any replies to flame me for being ignorant:
#1. I am unsure where to post requests on project-wonder requests, so
am sending here. Please advise.
#2. Caveat on below, code where I found this was linked to WO 5.2, not
WO 5.4, if I am out of date (i.e. the below is known to be no longer
an issue in WO54) or off-base on my request for other reasons, please
advise and accept my apology in advance. Nonetheless, it is still my
understanding that the notion of '...CaseInsensitive...' does not
apply very well to things like Boolean, Float, Long, CLOB, NSData, etc.
I am not a committer on the wonder tree, and would ask that somebody
do a review and place the request below under consideration.
I would request that the following method signatures be deprecated:
public static NSMutableArray<?>
sortedMutableArraySortedWithKey(NSArray array, String key)
public static <U> NSArray<U> sortedArraySortedWithKey(NSArray array,
String key)
And replaced using the exact same implementations, but with a new
signature, with something similar to:
public static NSMutableArray<?>
sortedMutableArraySortedWithKeyUsingToString(NSArray array, String key)
public static <U> NSArray<U>
sortedArraySortedWithKeyUsingToString(NSArray array, String key)
i.e. - rename the existing methods, and provide a deprecated method
with the old signature that just calls the new method.
Basis for this request is:
That the method signatures as-are do not adequately describe the
behavior of the method given the implicit cast of the KVC value from
its true value to its 'toString' value. Current method signatures
imply that the WebObjects KVC will honor 'equals()', which it does not.
I would also suggest that:
public static <U> NSArray<U> sortedArraySortedWithKey(NSArray array,
String key, NSSelector selector)
disallow a NULL NSSelector completely and throw an appropriate exception.
snippet from ERXArrayUtilities:
/**
* Sorts a given array with a key in ascending fashion and returns a
mutable clone of the result.
* @param array array to be sorted.
* @param key sort key.
* @return mutable clone of sorted array.
*/
// CHECKME ak: I probably wrote this, but do we really need it?
public static NSMutableArray<?>
sortedMutableArraySortedWithKey(NSArray array, String key) {
return sortedArraySortedWithKey(array, key).mutableClone();
}
/**
* Sorts a given array with a key in ascending fashion.
* @param array array to be sorted.
* @param key sort key.
* @return mutable clone of sorted array.
*/
public static <U> NSArray<U> sortedArraySortedWithKey(NSArray array,
String key) {
return sortedArraySortedWithKey(array, key, null);
}
/**
* Sorts a given array with a key in ascending fashion.
* @param array array to be sorted.
* @param key sort key.
* @param selector sort order selector to use, if null, then sort
will be case insensitive ascending.
* @return sorted array.
*/
public static <U> NSArray<U> sortedArraySortedWithKey(NSArray array,
String key, NSSelector selector) {
ERXAssert.PRE.notNull("Attempting to sort null array of
objects.", array);
ERXAssert.PRE.notNull("Attepting to sort array of objects with
null key.", key);
NSArray order=new NSArray(new Object[]
{EOSortOrdering.sortOrderingWithKey(key, selector == null ?
EOSortOrdering.CompareCaseInsensitiveAscending : selector)});
return EOSortOrdering.sortedArrayUsingKeyOrderArray(array, order);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden