Project Wonder 5.0

er.extensions.foundation
Class ERXArrayUtilities.SortOperator

java.lang.Object
  extended by er.extensions.foundation.ERXArrayUtilities.SortOperator
All Implemented Interfaces:
com.webobjects.foundation.NSArray.Operator
Enclosing class:
ERXArrayUtilities

public static class ERXArrayUtilities.SortOperator
extends java.lang.Object
implements com.webobjects.foundation.NSArray.Operator

Define an NSArray.Operator for the key sort.

This allows for key value paths like:

  1. myArray.valueForKey("@sort.firstName");
  2. myArray.valueForKey("@sort.lastName,firstName.length");
Which in the first case would return myArray sorted ascending by first name and the second case by lastName and then by the length() of the firstName. Due to the way the sort key arguments are written, this key cannot occur anywhere except at the very end of the keypath.


Constructor Summary
ERXArrayUtilities.SortOperator(com.webobjects.foundation.NSSelector selector)
          public empty constructor
 
Method Summary
 java.lang.Object compute(com.webobjects.foundation.NSArray<?> array, java.lang.String keypath)
          Sorts the given array by the keypath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXArrayUtilities.SortOperator

public ERXArrayUtilities.SortOperator(com.webobjects.foundation.NSSelector selector)
public empty constructor

Method Detail

compute

public java.lang.Object compute(com.webobjects.foundation.NSArray<?> array,
                                java.lang.String keypath)
Sorts the given array by the keypath.

Specified by:
compute in interface com.webobjects.foundation.NSArray.Operator
Parameters:
array - array to be sorted.
keypath - sort key.
Returns:
immutable sorted array.

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.