Re: Generics in WO - Writing accessors for to-many relationship?
Re: Generics in WO - Writing accessors for to-many relationship?
- Subject: Re: Generics in WO - Writing accessors for to-many relationship?
- From: Mike Schrag <email@hidden>
- Date: Thu, 1 Nov 2007 17:20:36 -0400
I let eclipse add the annotation to suppress the warning and I
changed the setRecords() to take an NSArray<Record>. So now the
accessors look as shown below:
1) You should really be using EOGenerator and not writing this by
hand, it's very error prone and it's asking for problems
2) You should really base those EOGenerator templates off of one of
the existing models
3) You never want to call setRecords with an array
4) I don't believe NSArray.EmptyArray is genericized properly (I'm not
sure it is in Project Wonder, either). The proper definition should be:
@SuppressWarnings("unchecked")
public static <T> NSArray<T> emptyArray() {
return NSArray.EmptyArray;
}
at which point you would use:
NSArray<String> emptyStringArray = NSArray.<String>emptyArray();
In the absence of that definition, you will need to cast (and add a
warning ignore).
ms
_______________________________________________
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