I have been using this for-loop structure in an app I'm currently
developing and it seems to work very well, and I haven't even needed
the .toArray() call at the end. Now, I'm not a WO expert so I can't
promise you that it will work in your specific circumstances.
This is an example of how I use it and cast the generic objects:
for (Object aRoutingObject : this.routings()) {
Routing aRouting = (Routing)aRoutingObject;
/* Stuff I want to do with each member (aRouting) of the routings()
to-many relationship
...
...
*/
}
On Mar 22, 2007, at 11:34 AM, Francis Labrie wrote:
It seems faults are fired on toArray(), objects() and mutableClone
() NSArray interface calls. So preliminary tests seems to allow
Java 5 enhanced for loop usage like this:
for(Object object : object.toManyRelationship().toArray()) {
...
}
Unfortunately, WebObjects classes dont use generics, so you still
have to type cast objects. :-(
Can someone confirms that using Java 5 enhanced loop in that way is
safe?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]