Re: EO generating and Interfaces
Re: EO generating and Interfaces
- Subject: Re: EO generating and Interfaces
- From: Mike Schrag <email@hidden>
- Date: Wed, 21 May 2008 22:43:35 -0400
The new templates generate a method like this :
public NSArray<com.apple.foo.model.WorkshopMaster> workshops() { return (NSArray<com.apple.foo.model.WorkshopMaster>)storedValueForKey("workshops"); }
where the old ones would leave the generic off. Now 99% of the time, this is perfect, but in this one case, WorkshopMaster also conforms to the RRSCalendarEvent interface, and that is what we want. Is there any way to have veogen change that or are we hosed and have lots of code to rewrite?
Hmm ... So you're saying you want NSArray<RSSCalendarEvent> returned from this? If WorkshopMaster implements RSSCalendarEvent, I'm not sure I follow what the problem is. It actually wouldn't be right to return NSArray<RSSCalendarEvent> because it's not really true. You can't put just any RSSCalendarEvent (or expect to get just any RSSCalendarEvent) out of that array, ONLY WorkshopMaster. It seems like declaring that method as returning NSArray<RSSCalendarEvent> would actually lose the type safety the generics are giving you here. That said, any code that is using the contents of that array that are using the RSSCalendarEvent API seems like it should work fine. Generic wrangling is total mojo, though, so can you give an example of a problem case of using that method as-is so I have a better idea of the problem?
Incidentally, you can use the wildcard type bounded by RSSCalendarEvent, though I'm not sure if it helps:
NSArray<? extends RSSCalendarEvent> people = whatever.workshops();
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