On Fri, May 29, 2009 at 11:00, Ricardo J. Parada <[email protected]> wrote:
>
>
> 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?
A subclass is not the same type as its superclass. What you probably
want is public Class<? extends MPVLoginPage> loginPageClass() {}
There's a lot more info at
http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
--
Phillip Hutchings
http://www.sitharus.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]