|
WebObjects 5.3 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.webobjects.foundation.NSArray
NSArray and its subclass NSMutableArray manage ordered collections of objects. NSArray creates immutable arrays and NSMutableArray creates mutable arrays.
The following table describes the NSArray methods that provide the basis for all NSArray's other methods; that is, all other methods are implemented in terms of these three. If you create a subclass of NSArray, you need only ensure that these base methods work properly. Having done so, you can be sure that all your subclass's inherited methods operate properly.
Method |
Description |
count |
Returns the number of elements in the array. |
objectAtIndex |
Provides access to the array elements by index. |
objectsNoCopy |
Returns a natural language array containing the NSArray's objects. |
The methods objectEnumerator and reverseObjectEnumerator grant sequential
access to the elements of the array, differing only in the direction of
travel through the elements. These methods are provided so that arrays can
be traversed in a manner similar to that used for objects of other collection
classes in both the Java API and in the Foundation framework, such as java.util.Hashtable
or NSDictionary. See the objectEnumerator method description for a
code excerpt that shows how to use these methods to access the elements of
an array.
NSArray provides methods for querying the elements of the array. indexOfObject
searches the array for the object that matches its argument. To determine
whether the search is successful, each element of the array is sent an
equals message. Another method, indexOfIdenticalObject, is
provided for the less common case of determining whether a specific object
is present in the array. indexOfIdenticalObject tests each element in
the array to see if it is the exact same instance as the argument.
To act on the array as a whole, a variety of other methods are defined.
You can extract a subset of the array (subarrayWithRange) or concatenate
the elements of an array of Strings into a single string
(componentsJoinedByString). In addition, you can compare two arrays using the
equals and firstObjectCommonWithArray methods. Finally, you can
create new arrays that contain the objects in an existing array and one or
more additional objects with arrayByAddingObject and
arrayByAddingObjectsFromArray.
List,
ArrayList,
Vector,
count(),
objectAtIndex(int),
indexOfObject(java.lang.Object),
arrayByAddingObjectsFromArray(com.webobjects.foundation.NSArray),
componentsJoinedByString(java.lang.String),
objectEnumerator(),
Serialized Form| Nested Class Summary | |
static interface |
NSArray.Operator
Objects implementing NSArray.Operator are used to perform operations on an array's elements. |
| Nested classes inherited from class com.webobjects.foundation.NSCoding |
NSCoding.Support |
| Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding |
NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor |
| Nested classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions |
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility |
| Field Summary | |
static String |
AverageOperatorName
A key representing the operator ( NSArray.Operator) that computes the average of the elements in an array. |
static String |
CountOperatorName
A key representing the operator ( NSArray.Operator) that computes the number of elements in an array. |
static NSArray |
EmptyArray
A constant representation of an empty array. |
static String |
MaximumOperatorName
A key representing the operator ( NSArray.Operator) that computes the largest element in an array. |
static String |
MinimumOperatorName
A key representing the operator ( NSArray.Operator) that computes the smallest element in an array. |
static int |
NotFound
This constant is returned by several search methods, indicating that no matching object was found. |
static String |
SumOperatorName
A key representing the operator ( NSArray.Operator) that computes the sum of the elements in an array. |
| Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding |
NullValue |
| Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions |
KeyPathSeparator |
| Constructor Summary | |
NSArray()
Creates an empty, immutable array. |
|
NSArray(List list,
boolean checkForNull)
Creates a NSArray from objects that implement the java.util.List interface. |
|
NSArray(NSArray otherArray)
One should use immutableClone instead. |
|
NSArray(Object object)
Creates an array containing the single element object. |
|
NSArray(Object[] objects)
Creates an array containing the elements from objects. |
|
NSArray(Object[] objects,
NSRange range)
Creates an array containing the objects from objects in the range
specified by range. |
|
NSArray(Vector vector,
NSRange range,
boolean ignoreNull)
Creates an array containing the objects from vector in the range
specified by range. |
|
| Method Summary | |
void |
add(int index,
Object element)
add is not a supported operation in NSArray |
boolean |
add(Object element)
add is not a supported operation in NSArray |
boolean |
addAll(Collection collection)
addAll is not a supported operation in NSArray |
boolean |
addAll(int index,
Collection collection)
addAll is not a supported operation in NSArray |
NSArray |
arrayByAddingObject(Object object)
Returns a new NSArray which contains the values from this array, and appends the object
argument. |
NSArray |
arrayByAddingObjectsFromArray(NSArray otherArray)
Returns a new NSArray which contains the values from this array, and appends values from the otherArray argument. |
ArrayList |
arrayList()
Creates a java.util.ArrayList with the same contents as this object. |
Class |
classForCoder()
Conformance to the NSCoding interface. |
void |
clear()
Operation not supported |
Object |
clone()
Clones this array Object Since NSArrays are immutable, there's no need to make an actual clone. |
String |
componentsJoinedByString(String separator)
This method concatenates the String representation of each element in this array together in order from lowest index to highest. |
static NSArray |
componentsSeparatedByString(String string,
String separator)
This static method tokenizes the string argument into a series of substrings according to separator
It creates a new NSArray which contains the substrings in the order they appeared in string. |
boolean |
contains(Object element)
Returns true if NSArray contains the specified element. |
boolean |
containsAll(Collection c)
|
boolean |
containsObject(Object object)
This method determines whether object is present
in this array by comparing it to each of the array's objects using equals |
int |
count()
|
static Object |
decodeObject(NSCoder coder)
Creates a new NSArray from the data in coder. |
void |
encodeWithCoder(NSCoder coder)
Encodes the receiver using coder. |
boolean |
equals(Object object)
Compares this array to object, returning
true if object satisfies instanceof NSArray
and its elements are equal to the elements of this array, otherwise it returns false. |
Object |
firstObjectCommonWithArray(NSArray otherArray)
This method searches for the first object in this array which is contained within otherArray. |
Object |
get(int index)
|
void |
getObjects(Object[] objects)
Deprecated. use public Object[] objects() instead |
void |
getObjects(Object[] objects,
NSRange range)
Deprecated. use public Object[] objects() in NSRange instead |
int |
hashCode()
|
NSArray |
immutableClone()
Since an NSArray is immutable, NSArray's implementation simply returns this. |
int |
indexOf(Object element)
|
int |
indexOfIdenticalObject(Object object)
Searches all objects in this array for object. |
int |
indexOfIdenticalObject(Object object,
NSRange range)
Searches the specified subset within this array for object
(testing for equality by directly comparing Object references with ==) and returns the first
(lowest) index whose corresponding element is identical to object. |
int |
indexOfObject(Object object)
Searches this array for object and returns the
first (lowest) index whose corresponding element is equal to object. |
int |
indexOfObject(Object object,
NSRange range)
Searches the specified subset within this array for object and
returns the first (lowest) index whose corresponding element is equal
to object. |
boolean |
isEmpty()
Returns true if this list contains no elements. |
boolean |
isEqualToArray(NSArray otherArray)
Included for backward compatibility. |
Iterator |
iterator()
|
int |
lastIndexOf(Object element)
|
Object |
lastObject()
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
void |
makeObjectsPerformSelector(NSSelector selector,
Object[] parameters)
Invokes the method specified by selector on each object in this
array. |
NSMutableArray |
mutableClone()
NSArray's implementation creates a new NSMutableArray with this array's elements, not copies. |
Object |
objectAtIndex(int index)
Returns the Object reference stored at index within this NSArray. |
Enumeration |
objectEnumerator()
This method creates a java.util.Enumeration which can used to iterate through the array's elements. |
Object[] |
objects()
|
Object[] |
objects(NSRange range)
Copies a subset of this array into a Java array. |
protected Object[] |
objectsNoCopy()
This method should only be used by subclasses. |
static NSArray.Operator |
operatorForKey(String operatorName)
|
static NSArray |
operatorNames()
Returns the names of the operations that can be performed on array elements. |
Object |
remove(int index)
Operation not supported |
boolean |
remove(Object object)
Operation not supported |
boolean |
removeAll(Collection collection)
Operation not supported |
static void |
removeOperatorForKey(String operatorName)
Removes the operator identified by operatorName from the list of
operators that can be performed on array elements. |
boolean |
retainAll(Collection collection)
Operation not supported |
Enumeration |
reverseObjectEnumerator()
This method creates a java.util.Enumeration which can used to iterate through the array's elements in reverse. |
Object |
set(int index,
Object element)
|
static void |
setOperatorForKey(String operatorName,
NSArray.Operator arrayOperator)
Registers an operator with a String. |
int |
size()
|
NSArray |
sortedArrayUsingComparator(NSComparator comparator)
This method creates a new array with this array's element which have been sorted in an order based on the comparator operation. |
NSArray |
sortedArrayUsingSelector(NSSelector selector)
Deprecated. use sortedArrayUsingComparator instead |
NSArray |
subarrayWithRange(NSRange range)
This method creates a new array from a subset of this array. |
List |
subList(int fromIndex,
int toIndex)
|
void |
takeValueForKey(Object value,
String key)
Conformance to the NSKeyValueCoding interface. |
void |
takeValueForKeyPath(Object value,
String keyPath)
Sets the value for the property identified by keyPath
to value. |
Object[] |
toArray()
|
Object[] |
toArray(Object[] objects)
|
String |
toString()
|
Object |
valueForKey(String key)
Conformance to the NSKeyValueCoding interface. |
Object |
valueForKeyPath(String keyPath)
Conformance to the NSKeyValueCodingAdditions interface. |
Vector |
vector()
Creates a java.util.Vector with the same contents as this object. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String AverageOperatorName
NSArray.Operator) that computes the average of the elements in an array.
public static final String CountOperatorName
NSArray.Operator) that computes the number of elements in an array.
public static final NSArray EmptyArray
public static final String MaximumOperatorName
NSArray.Operator) that computes the largest element in an array.
public static final String MinimumOperatorName
NSArray.Operator) that computes the smallest element in an array.
public static final int NotFound
public static final String SumOperatorName
NSArray.Operator) that computes the sum of the elements in an array.
| Constructor Detail |
public NSArray()
EmptyArraypublic NSArray(Object object)
object.
object is not permitted to be null
object - the single element within the new NSArray
java.lang.IllegalArgumentException - if object is nullpublic NSArray(Object[] objects)
objects.
objects must not be null,
but this method ignores any null values within objects.
objects - a Java array containing the initial values for
the newly created NSArray
public NSArray(Object[] objects,
NSRange range)
objects in the range
specified by range.
Ignores any null values it encounters in objects.
objects - a Java array containing initial values for the
newly created NSArrayrange - specifies which elements of the objects
array are to be addedpublic NSArray(NSArray otherArray)
immutableClone instead.
Creates a new array that contains the same object references as
otherArray.
otherArray must not be null.
otherArray - the array to be duplicatedimmutableClone()
public NSArray(List list,
boolean checkForNull)
java.util.List interface.
list - object that implements the List interfacecheckForNull - whether to check for null values in List or throw exception
IllegalArgumentException - if a null
element exists in List or List parameter is null.List
public NSArray(Vector vector,
NSRange range,
boolean ignoreNull)
vector in the range
specified by range.
The ignoreNull parameter controls the method's behavior
when it encounters a null value in the vector. If
ignoreNull is true, then null values
are simply ignored. If ignoreNull is false,
the method raises an IllegalArgumentException when it encounters a null
value.
vector - the Java.util.Vector of elements to be included in the new NSArrayrange - the range of objects to includeignoreNull - whether to ignore null values in vector or throw exception
IllegalArgumentException - if a null
element exists in vector.Vector| Method Detail |
public void add(int index,
Object element)
add in interface ListUnsupportedOperationExceptionList.add(java.lang.Object)public boolean add(Object element)
add in interface Listelement - - object to add
UnsupportedOperationExceptionList.add(java.lang.Object)public boolean addAll(Collection collection)
addAll in interface Listcollection - - collection to add
UnsupportedOperationExceptionList.addAll(java.util.Collection)
public boolean addAll(int index,
Collection collection)
addAll in interface Listindex - - index of element to addcollection - - collection to add
UnsupportedOperationExceptionList.addAll(java.util.Collection)public NSArray arrayByAddingObject(Object object)
object
argument.
If object is null, an IllegalArgumentException is thrown.
object - the object to be appended
object
appended
IllegalArgumentException - if object is null.NSMutableArray.addObject(java.lang.Object)public NSArray arrayByAddingObjectsFromArray(NSArray otherArray)
otherArray argument.
otherArray - the array to be appended
otherArray appended.NSMutableArray.addObjectsFromArray(com.webobjects.foundation.NSArray)public ArrayList arrayList()
public Class classForCoder()
classForCoder in interface NSCodingNSCoding.Support.classForCoder(java.lang.Object),
NSCoding,
NSMutableArraypublic void clear()
clear in interface ListUnsupportedOperationExceptionList.clear()public Object clone()
thisNSMutableArray,
immutableClone(),
mutableClone(),
Object.clone()public String componentsJoinedByString(String separator)
separator String is placed in between each element.
This is in all aspects the inverse function of componentsSeparatedByString
For example, this code excerpt writes the path System/Developer
to the console:
Each element in the receiver's array must handle eitherNSArray pathArray = new NSArray(new Object [] {{"System ","Developer "}); System.out.println("The path is "+pathArray.componentsJoinedByString("/")+".");
description,
or if it is not implemented, toString.
If the receiver has no elements,
a String representing the empty string is returned.
separator - the string to be inserted inbetween each element.
It may be any String object, including null or an empty String
separator between
the elements of this arraycomponentsSeparatedByString(java.lang.String, java.lang.String)
public static NSArray componentsSeparatedByString(String string,
String separator)
string argument into a series of substrings according to separator
It creates a new NSArray which contains the substrings in the order they appeared in string.
If string begins or ends with separator, then the first or last substring, respectively, is an empty String.
If string is null, or an empty String, then this method returns an NSArray with 0 elements.
If separator is null, or an empty String, then it returns an NSArray with 1 element, the string Object.
This method is in all aspects the inverse function of componentsJoinedByString
A code excerpt:
String list ="wrenches, hammers, saws"; NSArray listItems = NSArray.componentsSeparatedByString (", ");
produces an array with these contents:
Index |
Substring |
| 0 | wrenches |
| 1 | hammers |
| 2 | saws |
If list is instead
then the result is:String list =", wrenches, hammers, saws";
Index |
Substring |
| 0 | (empty string) |
| 1 | wrenches |
| 2 | hammers |
| 3 | saws |
If list has no separators, for example, "wrenches"
the array contains the string itself, in this case "wrenches".
string - the input string to be parsedseparator - the string that is to separate the substrings
string that have
been divided by separatorcomponentsJoinedByString(java.lang.String)public boolean contains(Object element)
contains in interface Listjava.lang.NulPointerException - if specified element is nullList.contains(java.lang.Object)public boolean containsAll(Collection c)
containsAll in interface ListList.containsAll(java.util.Collection)public boolean containsObject(Object object)
object is present
in this array by comparing it to each of the array's objects using equals
object - the searched for object
true if this array contains an object equal to object, otherwise falsepublic int count()
public static Object decodeObject(NSCoder coder)
coder.
This is the inverse function of encodeWithCoder
coder - the coder from which to retrieve the array's data
NSCodingpublic void encodeWithCoder(NSCoder coder)
NSCodingcoder. Object type information along with an
object's data is stored.
encodeWithCoder in interface NSCodingcoder - an NSCoder object that will be used to encode object of classes that
implement this interfaceNSCoderpublic boolean equals(Object object)
object, returning
true if object satisfies instanceof NSArray
and its elements are equal to the elements of this array, otherwise it returns false.
Two arrays have equal contents if they each hold the same number
of objects and objects at corresponding indices in each array satisfy the
equals test.
equals in interface Listobject - the object to compare this array against
true if object is an NSArray and its contents
are equal to this array or false otherwiseObject.equals(java.lang.Object)public Object firstObjectCommonWithArray(NSArray otherArray)
otherArray. It uses equals to check for equality.
otherArray - the input array
otherArray, or null if no such
object is foundpublic Object get(int index)
get in interface Listindex - - index of element to lookup
IndexOutOfBoundsException - if (index < 0 || index >= size())List.get(int)public void getObjects(Object[] objects)
public Object[] objects() instead
objects - the destination buffer to copy this array into. It must be large enough
to hold count Object references.objects()
public void getObjects(Object[] objects,
NSRange range)
public Object[] objects() in NSRange instead
objects - the destination buffer to copy a subset of this array into.
It must be large enough to hold count Object references.range - the subset of entries to copy into objectsobjects(NSRange range)public int hashCode()
hashCode in interface ListObject.hashCode()public NSArray immutableClone()
this. Subclasses such as NSMutableArray should override
this method to create an immutable copy of this array.
NSMutableArray,
mutableClone(),
clone()public int indexOf(Object element)
indexOf in interface Listjava.lang.NulPointerException - if specified element is nullList.indexOf(java.lang.Object)public int indexOfIdenticalObject(Object object)
object. The method tests for
equality by comparing object references directly using the == operator, and not
the equals method, and returns the first (lowest) index whose corresponding
element is identical to object.
If none of the objects in the receiver are identical to object,
this method returns NotFound.
object - the search's target
objectNotFound
public int indexOfIdenticalObject(Object object,
NSRange range)
object
(testing for equality by directly comparing Object references with ==) and returns the first
(lowest) index whose corresponding element is identical to object.
If none of the objects in the range match, then
this method returns NotFound. Throws an IllegalArgumentException
if range is out of bounds.
object - the search's targetrange - the subset to search
object
java.lang.IllegalArgumentException - if range is out of boundsNotFoundpublic int indexOfObject(Object object)
object and returns the
first (lowest) index whose corresponding element is equal to object.
Objects are considered equal if equals returns true. If
none of the specified objects are equal to object, returns NotFound.
object - the search's target
anObjectNotFound
public int indexOfObject(Object object,
NSRange range)
object and
returns the first (lowest) index whose corresponding element is equal
to object.
Objects are considered equal if equals returns true. If none of
the specified objects are equal to object, returns NotFound.
Throws an IllegalArgumentException if aRange is out of bounds.
object - the search's targetrange - the subset to search
equals to object
IllegalArgumentException - if aRange is out of bounds.public boolean isEmpty()
isEmpty in interface ListList.isEmpty()public boolean isEqualToArray(NSArray otherArray)
equals instead.
otherArray - the array to be compared against
true if otherArray and this array are
equal else falseequals(java.lang.Object)public Iterator iterator()
iterator in interface ListList.iterator()public int lastIndexOf(Object element)
lastIndexOf in interface Listjava.lang.NulPointerException - if specified element is nullList.lastIndexOf(java.lang.Object)public Object lastObject()
null if the array is emptypublic ListIterator listIterator()
listIterator in interface ListList.listIterator()public ListIterator listIterator(int index)
listIterator in interface Listindex - of first element to be returned from the list iterator (by a call to the next method).List.listIterator()
public void makeObjectsPerformSelector(NSSelector selector,
Object[] parameters)
selector on each object in this
array.
The method is invoked each time with the values in parametersas the
method's arguments. The method should not, as a side effect, modify this array or its elements.
selector - the method to invoke. selector must not be nullparameters - the arguments to that methodNSSelector.invoke( Object target, Object[] arguments)public NSMutableArray mutableClone()
NSMutableArray,
immutableClone(),
clone()public Object objectAtIndex(int index)
index within this NSArray.
If the array is empty or if index is beyond the end of the array
(that is, if index is greater than or equal to the value returned
by count), an IllegalArgumentException is thrown.
Negative index arguments are similarly illegal.
index - the location of the object
index
IllegalArgumentException - when index is not greater than
or equal to 0 and less than countcount()public Enumeration objectEnumerator()
java.util.Enumeration enumerator = myArray.objectEnumerator(); while (enumerator.hasMoreElements()) { Object anObject = enumerator.nextElement(); //code to act on each element }
When this method is used with mutable subclasses of NSArray, your code shouldn't modify the array during enumeration.
reverseObjectEnumerator()public Object[] objects()
public Object[] objects(NSRange range)
range - the range specifying a subset to copy
protected Object[] objectsNoCopy()
public static NSArray.Operator operatorForKey(String operatorName)
operatorName - the human-readable name for the operator instance
operatorName
if one exists, null otherwiseNSArray(java.util.Vector, com.webobjects.foundation.NSRange, boolean)public static NSArray operatorNames()
| Key | Operator Description |
count |
Returns the number of elements in an array. |
max |
Returns the element in the array with the highest value. |
min |
Returns the element in the array with the lowest value. |
avg |
Returns the average of the array's elements' values. |
sum |
Returns the sum of the array's element's values. |
public Object remove(int index)
remove in interface ListUnsupportedOperationExceptionList.remove(java.lang.Object)public boolean remove(Object object)
remove in interface ListUnsupportedOperationExceptionList.remove(java.lang.Object)public boolean removeAll(Collection collection)
removeAll in interface ListUnsupportedOperationExceptionList.removeAll(java.util.Collection)public static void removeOperatorForKey(String operatorName)
operatorName from the list of
operators that can be performed on array elements.
operatorName - the human-readable name for the operator
instance to be removedpublic boolean retainAll(Collection collection)
retainAll in interface ListUnsupportedOperationExceptionList.retainAll(java.util.Collection)public Enumeration reverseObjectEnumerator()
java.util.Enumeration enumerator = myArray.reverseObjectEnumerator(); while (enumerator.hasMoreElements()) { Object anObject = enumerator.nextElement(); //code to act on each element }
When this method is used with mutable subclasses of NSArray, your code shouldn't modify the array during enumeration.
objectEnumerator()
public Object set(int index,
Object element)
set in interface ListIndexOutOfBoundsException - if (index < 0 || index >= size())
UnsupportedOperationExceptionList.set(int, java.lang.Object)
public static void setOperatorForKey(String operatorName,
NSArray.Operator arrayOperator)
IllegalArgumentException if either operatorName or
arrayOperator are null.
operatorName - the human-readable name for the operator instancearrayOperator - the operator instance
IllegalArgumentException - if either
operatorName or
arrayOperator are nullpublic int size()
size in interface ListList.size()
public NSArray sortedArrayUsingComparator(NSComparator comparator)
throws NSComparator.ComparisonException
comparator operation.
comparator - It determines the ordering in the new sorted array by comparing two elements at a time and
returning one of OrderedAscending, OrderedSame or OrderedDescending
comparator
NSComparator.ComparisonException - if the comparator's compare
method throws for any reasonNSComparator.compare(java.lang.Object, java.lang.Object)
public NSArray sortedArrayUsingSelector(NSSelector selector)
throws NSComparator.ComparisonException
sortedArrayUsingComparator instead
selector - an NSSelector for the method to compare the elements during the sort
NSComparator.ComparisonExceptionsortedArrayUsingComparator(com.webobjects.foundation.NSComparator)
public List subList(int fromIndex,
int toIndex)
subList in interface ListIndexOutOfBoundsException - if index values fail the condition (fromIndex < 0 || toIndex > size || fromIndex > toIndex)List.subList(int, int)public NSArray subarrayWithRange(NSRange range)
range - the subset of elements to be included in the new array
range
java.lang.IndexOutOfBoundsException - when input range
is outside the bounds of this array
public void takeValueForKey(Object value,
String key)
takeValueForKeyPath on each element in this array
with the arguments value and key
For example, if key is "firstName" and value is "Unknown", this method sets the firstName property
of each element to "Unknown".
takeValueForKey in interface NSKeyValueCodingvalue - each element's new value for the keypathkey - the keypath for the property to set on each elementNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
public void takeValueForKeyPath(Object value,
String keyPath)
NSKeyValueCodingAdditionskeyPath
to value. A key path has the form relationship.property
(with one or more relationships); for example "movieRole.roleName"
or "movieRole.talent.lastName". The default implementation of
this method (provided by NSKeyValueCodingAdditions.DefaultImplementation)
gets the destination object for each relationship using valueForKey,
and sends the final object a takeValueForKey message with value
and property.
takeValueForKeyPath in interface NSKeyValueCodingAdditionsvalue - the property identified by keyPath is set to thiskeyPath - identifies the property of an objectNSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String),
NSKeyValueCodingAdditions.valueForKeyPath(java.lang.String),
NSKeyValueCodingAdditions.DefaultImplementationpublic Object[] toArray()
toArray in interface ListList.toArray()public Object[] toArray(Object[] objects)
toArray in interface ListList.toArray()public String toString()
public Object valueForKey(String key)
key indicates an operation
that doesn't require an argument, valueForKey performs the operation and returns the result.
key indicates an operation if its first character is "@". For example,
if key is "@count", valueForKey invokes compute on the "count"
operator. This has the effect of computing and returning the number of elements
in the receiver. Don't use valueForKey for operations that take
arguments; instead use valueForKeyPath.valueForKey creates a new array with the
same number of elements as this array. For each element, the corresponding element in the new array is the result
of invoking valueForKeyPath with key as the key path on the element. For example, if key is "firstName",
this method returns an array containing the firstName values for
each of the array's elements. The key argument can be a key path of the
form relationship.property. For example, "department.name".
valueForKey replaces null values with an instance of NSKeyValueCoding.Null.
valueForKey in interface NSKeyValueCodingkey - the input key
valueForKeyPath on each element of this arrayNSKeyValueCoding.valueForKey(java.lang.String),
operatorNames(),
valueForKeyPath(java.lang.String),
NSKeyValueCoding.Nullpublic Object valueForKeyPath(String keyPath)
keyPath indicates an operation
takes an argument (such as computing an average), valueForKeyPath
performs the operation and returns the result. key indicates an
aggregate operation if its first character is "@". For example,
if key is "@avg.salary", valueForKey invokes compute on
the "avg" operator specifying the array and "salary" as arguments. This
has the effect of computing and returning the average salary of
the array's elements.valueForKeyPath behaves similarly to valueForKey and
produces a new NSArray whose elements correspond to the results of invoking valueForKeyPath
on each element of this array.
valueForKeyPath in interface NSKeyValueCodingAdditionskeyPath - the keypath to the elements in the input array
valueForKeyPath on each element of this arrayvalueForKey(java.lang.String),
NSKeyValueCodingAdditions.valueForKeyPath(java.lang.String),
operatorNames()public Vector vector()
|
Last updated Thu May 26 13:46:12 PDT 2005. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||