S
sclaflin
I have a number of sets of matched parameterized classes: a bean, a
presenter, and a view.
The presenters and views have parallel inheritance hierarchies (where
T is the bean type, P the presenter type, and V is the view type):
public class CompA extends CompItem<AInfo, CompA, CompAView>
public class CompB extends CompItem<BInfo, CompB, CompBView>
public class CompAView extends CompItemView<AInfo, CompA, CompAView>
public class CompBView extends CompItemView<BInfo, CompB, CompBView>
public class CompItemView<T extends CompItemInfo,
P extends AbstractCompItem<T, P, V>,
V extends CompItemViewInterface<T, P,
V>>
extends AbstractCompItemView<T, P, V>
implements CompItemViewInterface<T, P, V>
public abstract class CompItem<T extends CompItemInfo,
P extends AbstractCompItem<T, P, V>,
V extends CompItemViewInterface<T,
P, V>>
extends AbstractCompItem<T, P, V>
implements CompWidget<T>
Many of the views are the same, so I wanted to just use the base view
class instead of creating a separate view class for each presenter.
So I tried:
public class CompA extends CompItem<AInfo, CompA, CompItemView>
But I get an error that says "The type CompItemView is not a valid
substitute for the bounded parameter <V extends
CompItemViewInterface<T,P,V>> of the type CompItem<T,P,V>.
Why can I use a class that extends CompItemView for the V type, and
not CompItemView itself?
presenter, and a view.
The presenters and views have parallel inheritance hierarchies (where
T is the bean type, P the presenter type, and V is the view type):
public class CompA extends CompItem<AInfo, CompA, CompAView>
public class CompB extends CompItem<BInfo, CompB, CompBView>
public class CompAView extends CompItemView<AInfo, CompA, CompAView>
public class CompBView extends CompItemView<BInfo, CompB, CompBView>
public class CompItemView<T extends CompItemInfo,
P extends AbstractCompItem<T, P, V>,
V extends CompItemViewInterface<T, P,
V>>
extends AbstractCompItemView<T, P, V>
implements CompItemViewInterface<T, P, V>
public abstract class CompItem<T extends CompItemInfo,
P extends AbstractCompItem<T, P, V>,
V extends CompItemViewInterface<T,
P, V>>
extends AbstractCompItem<T, P, V>
implements CompWidget<T>
Many of the views are the same, so I wanted to just use the base view
class instead of creating a separate view class for each presenter.
So I tried:
public class CompA extends CompItem<AInfo, CompA, CompItemView>
But I get an error that says "The type CompItemView is not a valid
substitute for the bounded parameter <V extends
CompItemViewInterface<T,P,V>> of the type CompItem<T,P,V>.
Why can I use a class that extends CompItemView for the V type, and
not CompItemView itself?