This syntax is for use when you need a generic placeholder.
In this case, it means that <W> is determined by the call site:
IModel<BusinessObject> model = OtherModel.wrapOnInheritance( Component );
The above means that W is checked to be "BusinessObject" for all
occurrences of W.
A better to understand example is to have a look at
java.util.Collections, eg: addAll
<http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#addAll%28java.util.Collection,%20T...%29>
It's signature is:
static <T> boolean addAll( Collection<? super T> c, T... elements);
Which means: you can only add elements of the generic type constraining
the collection (e.g. only add String elements to a Collection<String>).
Hope this helps!
Bas
Op 28-7-2011 19:48, schreef Niranjan Rao:
Ok, I admit it - I don't understand this function at all defined in
IComponentInheritedModel
public <W> IWrapModel<W> wrapOnInheritance(Component component)
I don't understand meaning of <W> and IWrapModel<W>. I know generics
generally, but this syntax has been baffling me. Based on what eclipse
is trying to do, it seems like it will return IWrapModel<W>, but then
what does first <W> do? I tried some google searches, but could not
find the answer.
Thanks,
Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org