Re: Educate me on generics please...
Re: Educate me on generics please...
- Subject: Re: Educate me on generics please...
- From: Johann Werner <email@hidden>
- Date: Wed, 6 Feb 2008 21:53:48 +0100
Am 06.02.2008 um 21:33 schrieb James Cicenia:
Well I have decided to to start going to 1.5 now.
this is something I do all the time:
NSMutableArray args2 = new NSMutableArray();
args2.addObject("portfolio");
args2.addObject(portfolio);
myQualifier2 = EOQualifier.qualifierWithQualifierFormat("%@ = %@",
args2);
NSArray results =
EOQualifier
.filteredArrayWithQualifier(portfolioUserGroups(),myQualifier2);
How do I make that "generic Java 1.5" friendly?
a generic friendly version would be:
NSMutableArray<Object> args2 = new NSMutableArray<Object>();
args2.addObject("portfolio");
args2.addObject(portfolio);
EOQualifier myQualifier2 =
EOQualifier.qualifierWithQualifierFormat("%@ = %@", args2);
NSArray<EOGenericRecord> results =
(NSArray
<
EOGenericRecord
>
)EOQualifier
.filteredArrayWithQualifier(portfolioUserGroups(),myQualifier2);
The mutable array uses Object as type so you can intermix diffent
kinds of types as in your example. The results array will consist of
one single type of entities so you should set it to whatever entity
type you expect (I used EOGenericRecord as superclass as I don't know
of what type the result should be). If you are using WO prior to 5.4
you have to typecast the return value of filteredArrayWithQualifier
because genericised (?) functions appeared only in 5.4.
jw
Thanks,
James Cicenia
_______________________________________________
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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