• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Generics and Filtering on a Subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Generics and Filtering on a Subclass
      • From: David Avendasora <email@hidden>
  • Prev by Date: Re: Generics and Filtering on a Subclass
  • Next by Date: Re: Generics and Filtering on a Subclass
  • Previous by thread: Re: Where is WOResourceManager looking in dev?
  • Next by thread: Re: Generics and Filtering on a Subclass
  • Index(es):
    • Date
    • Thread