Hi Elco, hi Users,

first of all thanks a lot for trying generics in wicket in the first case.
I haven't really cared about em so far, too much. So thanks a lot for the learning experience I'm going through right now.
   [x] Can best be done in a limited fashion, where we only generify
IModel but not components. I care more about what generifying can do
for API clarity (declaring a component to only accept certain models
for instance) than static type checking.
What currently bus me is that Components are tightly knitted together with their class representation.
There are quite some methods that don't return the component,
but its class. Maybe most prominently 'getHomePage()' in Application.

This used to have the signature:
public abstract Class getHomePage();

And a popular implementation would be:
public Class getHomePage() {
   return HomePage.class
}

So maybe in favor of that popular implementation its current signature is:

Application: public abstract Class<? extends Page<?>> getHomePage();

which is not a generic method but a method with a generified return parameter.
But at least this works with the existing user code basis very well.
But it also implies a circle I can't break up in my mind yet.
This signature forces you to implement HomePage as a raw type, a class without type parameters, esp. not generic. Though on the other hand HomePage is a descendant of Component which is generic, of course.
Which is a strong sign for HomePage to be generic too.

I think both ends don't go together well.

How is this going to be solved? Or, explained?

My tries on the signature of getHomePage() didn't really lead nowhere.
The best Try on this is:
public abstract <C extends Page> Class<C> getHomePage();

Leaving Page and possibly Component raw.

Maybe it is enough to just generify some of Components methods?
2) How strongly do you feel about your choice above?
   [x] I might rethink upgrading if my choice doesn't win.
mf

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to