Re: Generics question
Re: Generics question
- Subject: Re: Generics question
- From: "Ricardo J. Parada" <email@hidden>
- Date: Thu, 28 May 2009 21:08:10 -0400
Thanks Phillip and Bill!
That worked! :-)
And thanks for the tutorial PDF.
On May 28, 2009, at 7:17 PM, Bill Gallop wrote: Ricardo, Try defining your loginPageClass() like this: public Class<? extends MPVLoginPage> loginPageClass() { ... } and override accordingly. Then Java will allow you to return any subclass of MPVLoginPage. Bill From: Ricardo J. Parada [mailto:email@hidden] To: WebObjects-Dev Apple [mailto:email@hidden] Sent: Thu, 28 May 2009 17:00:06 -0600 Subject: Generics question
I'm changing my code to use pageWithName(Foo.class) instead of pageWithName("Foo") through out the code.
Then I used to have a method that return the name of the login page which I changed to return the class of the login page. But then if an application wants to override that I end up with stuff like this:
public Class<MPVLoginPage> loginPageClass() { return PPPLoginPage.class; }
Here PPPLoginPage is a subclass of MPVLoginPage and I thought this would be allowed by java but I'm getting an error and I have not mastered generics that well yet. ;-)
Is there a better way to do this?
:-)
|
_______________________________________________
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