public static class ERXArrayUtilities.LimitOperator extends Object
NSArray.Operator
for the key limit, which is similar to subarrayWithRange except it is
always from 0 to the limit value. If the limit specified is larger than the
size of the array, the entire array will be returned.
This allows for key value paths like:
myArray.valueForKeyPath("@limit.10.someOtherPath");
Which in this case would return the first 10 objects in myArray
before continuing to process someOtherPath
.BaseOperator
Constructor and Description |
---|
LimitOperator() |
Modifier and Type | Method and Description |
---|---|
Object |
compute(NSArray array,
String keypath)
Computes the subarray of the given array.
|
Object |
contents(NSArray<?> array,
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. |
public Object compute(NSArray array, String keypath)
array
- array to be truncated.keypath
- the key path to follow after truncation.public Object contents(NSArray<?> array, String keypath)
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.array
- the array value for the operatorkeypath
- the keypath to call on the array argumentCopyright © 2002 – 2020 Project Wonder.