Project Wonder 5.0

er.extensions.foundation
Class ERXArrayUtilities.SubarrayWithRangeOperator

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

public static class ERXArrayUtilities.SubarrayWithRangeOperator
extends java.lang.Object

Define an NSArray.Operator for the key subarrayWithRange.

This allows for key value paths like:

myArray.valueForKeyPath("@subarrayWithRange.20-3.someOtherPath");

Which in this case would return the three objects from myArray, starting at the index of 20, before continuing to process someOtherPath.

Note that the syntax for the range argument is not startIndex-endIndex. The API matches that of NSRange. You must provide a start index and an array length.

See Also:
BaseOperator

Constructor Summary
ERXArrayUtilities.SubarrayWithRangeOperator()
          public empty constructor
 
Method Summary
 java.lang.Object compute(com.webobjects.foundation.NSArray<?> array, java.lang.String keypath)
           
 java.lang.Object contents(com.webobjects.foundation.NSArray<?> array, java.lang.String keypath)
          Rather than iterating through the array argument calling valueForKeyPath on each array object, this method operates by calling valueForKeyPath on the array argument instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXArrayUtilities.SubarrayWithRangeOperator

public ERXArrayUtilities.SubarrayWithRangeOperator()
public empty constructor

Method Detail

compute

public java.lang.Object compute(com.webobjects.foundation.NSArray<?> array,
                                java.lang.String keypath)
Parameters:
array - array to truncate
keypath - the key path to follow after truncation
Returns:
the value produced by the keypath after truncating the array

contents

public java.lang.Object contents(com.webobjects.foundation.NSArray<?> array,
                                 java.lang.String keypath)
Rather than iterating through the array argument calling valueForKeyPath on each array object, this method operates by calling valueForKeyPath on the array argument instead. This method is used by Wonder operators to chain multiple array operators in a single key path.

Parameters:
array - the array value for the operator
keypath - the keypath to call on the array argument
Returns:
the object value produced by valueForKeyPath, or the array itself if the keypath is empty

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

Copyright © 2002 – 2007 Project Wonder.