Generics and Filtering on a Subclass
Generics and Filtering on a Subclass
- Subject: Generics and Filtering on a Subclass
- From: David Avendasora <email@hidden>
- Date: Mon, 23 Jun 2008 10:45:38 -0400
Hi all,
I am trying to take an array (decendentParts()) of "Part" objects and
filter only for the elements that are of the subclass "Finished".
Before Generics, I simply used: (yes, yes, I know I shouldn't be using
qualifierWithQualifierFormat - please let it go, this one time)
EOQualifier qual =
EOQualifier.qualifierWithQualifierFormat("partTypeId = 3", null);
NSArray descendantFinisheds =
EOQualifier.filteredArrayWithQualifier(descendantParts(), qual);
But now, with generics, the compiler complains that it can't convert
from "Part" to "Finished". Which I completely understand because
there's no way for the compiler to know that I just filtered for a
subclass and that all I'm going to get out of the filter process is
Finished objects so the statement is valid. As far as it's concerned,
I could be getting any subclass of "Part" back.
My question is, how do I filter so that the compiler will know that
the results of the filter truly are Finished objects?
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden